-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenu.cpp
More file actions
110 lines (93 loc) · 3.51 KB
/
Copy pathMenu.cpp
File metadata and controls
110 lines (93 loc) · 3.51 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#include <iostream>
#include "Game3.h"
#include "Game2.h"
#include "Game1.h"
#include "BoardGame_Classes.hpp"
using namespace std;
int main() {
int n = 0;
while ( n == 0) {
cout<<"Welcome ya Ala Player ^_^ "<<endl;
cout<<"Menu: "<<"\n"<<"(1)Traditional X_O\n"<<"(2) Pyramic Tic-Tac-Toe"
<<"\n"<<"(3) Four-in-a-row "<<"\n"<<"(4) 5 x 5 Tic Tac Toe "<<"\n"<<"(5) Exit"<<endl;
//------------------------------------------------------------------------------------------
int choice;
cout<<"Enter your choice ^_^ : ";
cin>>choice;
cout<<"\n";
if(choice == 1) {
int choice_player;
Player* players[2];
players[0] = new Player (1, 'x');
cout << "Welcome to FCAI X-O Game. :)\n";
cout << "Press 1 if you want to play with computer: ";
cin >> choice_player;
if (choice_player != 1)
players[1] = new Player ( 'o');
else
//Player pointer points to child
players[1] = new RandomPlayer ('o', 5); // change dimension
GameManager x_o_game (new X_O_Board, players);
x_o_game.run();
system ("pause");
}
else if(choice == 2){
int choice_player;
Player1* players[2];
players[0] = new Player1 (1, 'x');
cout << "Welcome to FCAI X-O Game. :)\n";
cout << "Press 1 if you want to play with computer: ";
cin >> choice_player;
if (choice_player != 1)
players[1] = new Player1 ( 'o');
else
//Player pointer points to child
players[1] = new RandomPlayer1 ('o', 5); // change dimension
GameManager1 x_o_game1 (new pyramid_X_O_Board, players);
x_o_game1.run();
system ("pause");
}
else if(choice == 3){
int choice_player;
Player2* players[2];
players[0] = new Player2 (1, 'x');
cout << "Welcome to FCAI X-O Game. :)\n";
cout << "Press 1 if you want to play with computer: ";
cin >> choice_player;
if (choice_player != 1)
players[1] = new Player2 ( 'o');
else
//Player pointer points to child
players[1] = new RandomPlayer2 ('o', 7); // change dimension
GameManager2 x_o_game2 (new Connect_four_Board, players);
x_o_game2.run();
system ("pause");
}
else if (choice == 4){
int choice_player;
Player3* players[2]; // change to Player3
players[0] = new Player3 ('x');
cout << "Welcome to FCAI X-O Game. :)\n";
cout << "Press 1 if you want to play with computer: ";
cin >> choice_player;
if (choice_player != 1)
players[1] = new Player3 ( 'o');
else
//Player pointer points to child
players[1] = new RandomPlayer3 ('o', 5); // change dimension
GameManager3 x_o_game3( new Game3_X_O_Board, players);
x_o_game3.run();
system ("pause");
}
else if (choice == 5){
cout<<"Thank you for using our games ^_^ see you later ^_^ "<<endl;
break;
}
else{
cout<<"Invalid choice, Please enter valid choice ^_^\n";
cout<<"Enter zero to show Menu again ^_^ : ";
cin>>choice;
cout<<"\n";
}
}
}