Skip to content

Commit 863e508

Browse files
authored
Add files via upload
1 parent 3ea9660 commit 863e508

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

marker.hpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#pragma once
2+
3+
#include "table.hpp"
4+
/**
5+
* @brief Legal moves are marked with LEGAL
6+
* @param none
7+
* @return nothing
8+
*/
9+
void Table::marker()
10+
{
11+
// unmarkes all the old marked squares
12+
/////////////////////////////////////////////////////
13+
for (int row = 0; row < SIZE; row++)
14+
{
15+
for (int col = 0; col < SIZE; col++)
16+
{
17+
if (this->board[row][col] == LEGAL)
18+
this->board[row][col] = EMPTY;
19+
}
20+
}
21+
/////////////////////////////////////////////////////
22+
23+
// marks all the legal squares for the current player
24+
/////////////////////////////////////////////////////
25+
coor c;
26+
// all the squares are checked
27+
for (int row = 0; row < SIZE; row++)
28+
{
29+
for (int col = 0; col < SIZE; col++)
30+
{
31+
c.row = row;
32+
c.col = col;
33+
if (isLegal(c))
34+
this->board[c.row][c.col] = LEGAL;
35+
}
36+
}
37+
/////////////////////////////////////////////////////
38+
}

0 commit comments

Comments
 (0)