-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview.cc
More file actions
35 lines (31 loc) · 707 Bytes
/
view.cc
File metadata and controls
35 lines (31 loc) · 707 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
#include "view.h"
#include "board.h"
#include <vector>
using namespace std;
View::View() {
theDisplay = vector<vector<char>>(size, vector<char>(size));
for (int i = 0; i < size; ++i) {
for (int j = 0; j < size; ++j) {
if (i % 2 == 0) {
if (j % 2 == 0) theDisplay[i][j] = '_';
else theDisplay[i][j] = ' ';
} else {
if (j % 2 == 0) theDisplay[i][j] = ' ';
else theDisplay[i][j] = '_';
}
}
}
}
View::~View() {}
void View::notify(char piece, Coor coor) {
if (piece == 'E') {
if (coor.x % 2 == 0) {
if (coor.y % 2 == 0) piece = '_';
else piece = ' ';
} else {
if (coor.y % 2 == 0) piece = ' ';
else piece = '_';
}
}
theDisplay[coor.x][coor.y] = piece;
}