-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReversiConsoleView.cpp
More file actions
43 lines (38 loc) · 889 Bytes
/
Copy pathReversiConsoleView.cpp
File metadata and controls
43 lines (38 loc) · 889 Bytes
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
/*
* ReversiConsoleView.cpp
*
* Created on: 07-Nov-2023
* Author: Sai Swaroop Maram
*/
#include "ReversiConsoleView.h"
using namespace std;
ReversiConsoleView::ReversiConsoleView(ReversiBoard *b)
{
Board = b;
cout<<"ReversiConsoleView Object created at "<<this<<endl;
}
ReversiConsoleView::~ReversiConsoleView()
{
cout<<"ReversiConsoleView Object destructed at "<<this<<endl;
}
/**
* Prints the Board on screen
*/
void ReversiConsoleView::print() const
{
for(int row_itr = 0; row_itr < 8; row_itr++)
{
for (int col_itr = 0; col_itr < 8; col_itr++)
{
if(Board->stateOfSquare(row_itr, col_itr) \
== ReversiBoard::P1_DISK)
cout<<" B ";
else if(Board->stateOfSquare(row_itr, col_itr) \
== ReversiBoard::P2_DISK)
cout<<" W ";
else
cout<<" . ";
}
cout<<endl;
}
}