-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
66 lines (54 loc) · 2 KB
/
main.cpp
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <iostream>
#include <vector>
#include "Pieces.h"
#include "functsForMain.h"
using namespace std;
int main() {
vector<vector<Pieces*>> board (7);
bool done = false;
bool moved;
bool turnTracker = true;
char input;
cout << "Welcome to this virtual version of Brandubh, in the Tafl family of games. This game is played with two teams:"
<< "\nAttackers, represented by an 'A' and Defenders, represented by a 'D'. The goal of the Defenders is to get their\n"
"King (represented by 'K') to the edge of the board. The board is 7 x 7, represented here by a grid with coordinates\n"
"from 0-6 horizontally (x-values) and vertically (y-values). Pieces may be captured by getting two of the opposing\n"
"team's pieces on either side of it. For this version, the King may not participate in captures. The center square\n"
" (3, 3) is called the Throne, and the King cannot be captured there unless there is an Attacker on each side."
<< endl << endl;
InitializeBoard(board);
while (!done) {
if (turnTracker) {
cout << "Attacker's turn." << endl;
}
else {
cout << "Defender's turn." << endl;
}
cout << "Find the piece you would like to move. Will it be an \n"
"(a) horizontal or \n"
"(b) vertical \n"
"movement?" << endl;
moved = false;
while (!moved) {
cin >> input;
if (input == 'a') {
MoveXAxis(board, done, turnTracker);
moved = true;
}
else if (input == 'b') {
MoveYAxis(board, done, turnTracker);
moved = true;
}
else {
cout << "Invalid choice. Please type 'a' or 'b'." << endl;
}
}
turnTracker = !turnTracker;
}
for (const vector<Pieces*>& row : board) {
for (Pieces* piece : row) {
delete piece;
}
}
return 0;
}