-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGames.cpp
More file actions
107 lines (102 loc) · 2.8 KB
/
Copy pathGames.cpp
File metadata and controls
107 lines (102 loc) · 2.8 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
// File name:Games.cpp
// Author(s):youssef karem wiliam-Arsany nageh Attia-juliana George
// ID(s):20220402-20220052-20221045
// Section:20
// Date:15/12/2023
#include<bits/stdc++.h>
using namespace std;
#include <BoardGame_Classes.hpp>
void Connect_four_Game()
{
int choice;
cout << "Welcome to FCAI Connect-Four Game. :)\n";
cout << "Press 1 if you want to play with computer: ";
cin >> choice;
Player *players[2];
players[0]=new connectFour_player(1,'X');
Board *board=new connectFour_Board;
if (choice != 1)
players[1] = new connectFour_player (2, 'O');
else
//Player pointer points to child
players[1] = new ConnectFour_AI_Player ('O',board);
GameManager ConnectFour_Game(board,players);
ConnectFour_Game.run();
}
void Pyramic_Tic_Tac_Toe()
{
int choice;
cout << "Welcome to Pyramic_Tic_Tac_Toe Game. :)\n";
cout << "Press 1 if you want to play with computer: ";
cin >> choice;
Player *players[2];
players[0]=new PY_Player(1,'X');
if (choice != 1)
players[1] = new PY_Player (2, 'o');
else
//Player pointer points to child
players[1] = new New_RandomPlayer ('o',5,3);
GameManager Pyramic_Tic_Tac_Toe_game(new PY_Board,players);
Pyramic_Tic_Tac_Toe_game.run();
}
void Tic_Tac_Toe ()
{
int choice;
Player* players[2];
players[0] = new Player (1, 'x');
cout << "Welcome to FCAI Tic_Tac_Toc Game. :)\n";
cout << "Press 1 if you want to play with computer and any number except 1 for another player : ";
cin >> choice;
if (choice != 1)
players[1] = new Player (2, 'o');
else
//Player pointer points to child
players[1] = new New_RandomPlayer ('o', 5,5);
GameManager_Tic_Tac_Toc x_o_game (new Tic_Tac_Toe_Board(), players);
x_o_game.run();
}
void X_O_Game()
{
int choice;
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;
if (choice != 1)
players[1] = new Player (2, 'o');
else
//Player pointer points to child
players[1] = new RandomPlayer ('o', 3);
GameManager x_o_game (new X_O_Board(), players);
x_o_game.run();
}
int main()
{
string message =R"(Welcome to FCAI games. :)
1-Pyramic_Tic_Tac_Toe
2-Connect-Four
3-Tic_Tac_Toe
4-X_O
choose game from (1:4):
)";
cout<<message;
int choice;cin>>choice;
switch (choice) {
case 1:
Pyramic_Tic_Tac_Toe();
break;
case 2:
Connect_four_Game();
break;
case 3:
Tic_Tac_Toe();
break;
case 4:
X_O_Game();
break;
default:
cout<<"The game is not valid\n";
}
system ("pause");
}