-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
68 lines (51 loc) · 1.92 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
67
68
#include "ai/StrategyGame.h"
#include "ai/GameBoard.h"
#include "ai/asg.h"
#include "games/ConnectFour.h"
#include "games/Hex.h"
#include "games/Reversi.h"
#include "games/TicTacToe.h"
#include <iostream>
#include <vector>
#include <string>
int main() {
int play_again = 1;
while (play_again == 1) {
StrategyGame app;
std::vector<std::string> games_list = {"Connect Four", "Hex (7 x 7)", "Reversi (Othello)", "Tic-Tac-Toe"};
asg::line_break(30);
std::cout << "\t" << "Abstract Strategy Games" << std::endl;
std::cout << "\t" << "by Shawn Chahal" << std::endl;
asg::line_break(30);
std::cout << "\t" << "Select a game:" << std::endl << std::endl;
for (int i = 0; i < games_list.size(); i++) {
std::cout << "\t" << i + 1 << ") " << games_list[i] << std::endl;
}
std::cout << "\t" << std::endl;
std::cout << "\t" << "Enter a number: ";
int g_index = asg::menu_input(games_list.size());
asg::line_break(30);
if (games_list[g_index - 1] == "Tic-Tac-Toe") {
TicTacToe game;
app.run(game);
} else if (games_list[g_index - 1] == "Connect Four") {
ConnectFour game;
app.run(game);
} else if (games_list[g_index - 1] == "Reversi (Othello)") {
Reversi game;
app.run(game);
} else if (games_list[g_index - 1] == "Hex (7 x 7)") {
Hex game;
app.run(game);
}
std::vector<std::string> options = {"Return to main menu", "Exit"};
std::cout << std::endl;
for (int i = 0; i < options.size(); i++) {
std::cout << "\t" << i + 1 << ") " << options[i] << std::endl;
}
std::cout << "\t" << std::endl;
std::cout << "\t" << "Enter a number: ";
play_again = asg::menu_input(options.size());
}
return 0;
}