-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprint_board.cpp
More file actions
49 lines (44 loc) · 1.11 KB
/
print_board.cpp
File metadata and controls
49 lines (44 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#pragma once
#include "table.hpp"
/**
* @brief Prints the board with two nested for loops
*
* @param none
*
* @return nothing
*/
void Table::printBoard()
{
int row, col;
// clear the screen
system("cls");
cout << " ";
// printing the number for a better understanding of the coordinates
for (row = 0; row < SIZE; row++)
cout << " " << row + 1;
cout << endl;
for (row = 0; row < SIZE; row++)
{
cout << row + 1 << " ";
for (col = 0; col < SIZE; col++)
{
// in case user does not want guidiance
// legal squares are hidden with EMPTY
if (!getGuidance())
{
if (getBoard({row, col}) == LEGAL)
{
cout << EMPTY << " ";
continue;
}
}
// printing the tiles
cout << getBoard({row, col}) << " ";
}
cout << row + 1;
cout << endl;
}
cout << " ";
for (row = 0; row < SIZE; row++)
cout << " " << row + 1;
}