-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameList.h
More file actions
146 lines (126 loc) · 4.33 KB
/
GameList.h
File metadata and controls
146 lines (126 loc) · 4.33 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#include <iostream>
#include "MySTL/vector.h"
#include <tuple>
#include "Engine/Player.h"
#include "Engine/Ai.h"
#include "Engine/GameEngine.h"
#include "TicTacToe/TTT.h"
#include "TicTacToe/TTTBoard.h"
#include "Connect4/Connect4.h"
#include "Connect4/Connect4Board.h"
#include <unordered_map>
void TTT_Plugin()
{
//clear the screen
std::cout << "\033[2J\033[1;1H";
//display ascii art
std::cout << " _______ _ _______ _______ " << endl;
std::cout << " |__ __(_) |__ __| |__ __| " << endl;
std::cout << " | | _ ___ | | __ _ ___ | | ___ ___ " << endl;
std::cout << " | | | |/ __| | |/ _` |/ __| | |/ _ \\ / _ \\" << endl;
std::cout << " | | | | (__ | | (_| | (__ | | (_) | __/" << endl;
std::cout << " |_| |_|\\___| |_|\\__,_|\\___| |_|\\___/ \\___|" << endl;
std::cout<<"Which Mode you will like "<<std::endl;
std::cout<<"1. Human v/s Human "<<std::endl;
std::cout<<"2. AI v/s Human "<<std::endl;
std::cout<<"3. Human v/s AI "<<std::endl;
std::cout<<"4. AI v/s AI "<<std::endl;
int wish ;
std::cout<<"Wish : "<<std::endl;
cin>>wish;
TTT gamePack;
// HumanPlayer h1, h2;
// AIPlayer<TTT> ai_1(&gamePack),ai_2(&gamePack);
if(wish == 1)
{
HumanPlayer h1, h2;
h1.initialize_player(0);
h2.initialize_player(1);
GameEngine<TTT,HumanPlayer*,HumanPlayer*> gameEngine(&gamePack,&h1,&h2);
gameEngine.game_loop();
}
else if(wish ==2){
HumanPlayer h2;
AIPlayer<TTT> ai_1(&gamePack);
ai_1.initialize_player(0);
h2.initialize_player(1);
GameEngine<TTT,AIPlayer<TTT>*,HumanPlayer*> gameEngine(&gamePack,&ai_1,&h2);
gameEngine.game_loop();
}
else if(wish ==3){
HumanPlayer h1;
AIPlayer<TTT> ai_2(&gamePack);
h1.initialize_player(0);
ai_2.initialize_player(1);
GameEngine<TTT,HumanPlayer*,AIPlayer<TTT>*> gameEngine(&gamePack,&h1,&ai_2);
gameEngine.game_loop();
}
else{
AIPlayer<TTT> ai_1(&gamePack),ai_2(&gamePack);
ai_1.initialize_player(0);
ai_2.initialize_player(1);
GameEngine<TTT,AIPlayer<TTT>*,AIPlayer<TTT>*> gameEngine(&gamePack,&ai_1,&ai_2);
gameEngine.game_loop();
}
}
void Connect4_Plugin()
{
std::cout << "\033[2J\033[1;1H";
std::cout<<" ____ _ _ _ "<<endl;
std::cout<<" / ___|___ _ __ _ __ ___ ___| |_| || | "<<endl;
std::cout<<"| | / _ \\| '_ \\| '_ \\ / _ \\/ __| __| || |_ "<<endl;
std::cout<<"| |__| (_) | | | | | | | __/ (__| |_|__ _|"<<endl;
std::cout<<" \\____\\___/|_| |_|_| |_|\\___|\\___|\\__| |_| "<<endl;
std::cout<<"Which Mode you will like "<<std::endl;
std::cout<<"1. Human v/s Human "<<std::endl;
std::cout<<"2. AI v/s Human "<<std::endl;
std::cout<<"3. Human v/s AI "<<std::endl;
std::cout<<"4. AI v/s AI "<<std::endl;
std::cout<<"5. Human v/s AI [Do not Play] "<<std::endl;
int wish ;
std::cout<<"Wish : "<<std::endl;
cin>>wish;
Connect4 gamePack;
// HumanPlayer h1, h2;
// AIPlayer<TTT> ai_1(&gamePack),ai_2(&gamePack);
if(wish == 1)
{
HumanPlayer h1, h2;
h1.initialize_player(0);
h2.initialize_player(1);
GameEngine<Connect4,HumanPlayer*,HumanPlayer*> gameEngine(&gamePack,&h1,&h2);
gameEngine.game_loop();
}
else if(wish ==2){
HumanPlayer h2;
AIPlayer<Connect4> ai_1(&gamePack);
ai_1.initialize_player(0);
h2.initialize_player(1);
GameEngine<Connect4,AIPlayer<Connect4>*,HumanPlayer*> gameEngine(&gamePack,&ai_1,&h2);
gameEngine.game_loop();
}
else if(wish ==3){
HumanPlayer h1;
AIPlayer<Connect4> ai_2(&gamePack);
h1.initialize_player(0);
ai_2.initialize_player(1);
GameEngine<Connect4,HumanPlayer*,AIPlayer<Connect4>*> gameEngine(&gamePack,&h1,&ai_2);
gameEngine.game_loop();
}
else if(wish == 5){
HumanPlayer h1;
AIPlayer<Connect4> ai_2(&gamePack);
h1.initialize_player(0);
ai_2.initialize_player(1);
GameEngine<Connect4,HumanPlayer*,AIPlayer<Connect4>*> gameEngine(&gamePack,&h1,&ai_2);
gameEngine.game_loop();
}
else{
AIPlayer<Connect4> ai_1(&gamePack),ai_2(&gamePack);
ai_1.initialize_player(0);
ai_2.initialize_player(1);
GameEngine<Connect4,AIPlayer<Connect4>*,AIPlayer<Connect4>*> gameEngine(&gamePack,&ai_1,&ai_2);
gameEngine.game_loop();
}
}
unordered_map<std::string,void(*)()> game_collection;