-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.cpp
49 lines (48 loc) · 1.61 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
#include "Header/chess.h"
#include <iostream>
#include <time.h>
#include <windows.h>
int main() {
srand((unsigned int)time(NULL));
Chess c("ArasDasDas", WHITE_BOT_DIFFICULTY, "MCihan899", BLACK_BOT_DIFFICULTY);
ShowWindow(GetConsoleWindow(), SW_MAXIMIZE);
if(AGAINST_BOT) {
do {
c.PrintBoard();
if(TWO_BOTS) { // bot vs bot (no human)
MoveCursorToXY(RIGHT, DOWN + 3*BOARD_SIZE + 5);
std::cout << CLEAR_LINE << std::endl << std::endl << CLEAR_LINE;
while(c.BotsTurn());
}
else {
if(BOT_IS_WHITE)
while(true) { // team black player vs team white bot
MoveCursorToXY(RIGHT, DOWN + 3*BOARD_SIZE + 5);
std::cout << CLEAR_LINE << std::endl << std::endl << CLEAR_LINE;
if(!c.BotsTurn())
break;
std::cout << std::endl << TO_RIGHT << "Enter move coordinates (x1,y1)->(x2,y2):";
std::cout << std::endl << std::endl << TO_RIGHT << "All possible moves:" << std::endl;
if(!c.PlayersTurn())
break;
}
else
while(true) { // team white player vs team black bot
if(!c.PlayersTurn())
break;
MoveCursorToXY(RIGHT, DOWN + 3*BOARD_SIZE + 5);
std::cout << CLEAR_LINE << std::endl << std::endl << CLEAR_LINE;
if(!c.BotsTurn())
break;
std::cout << std::endl << TO_RIGHT << "Enter move coordinates (x1,y1)->(x2,y2):";
std::cout << std::endl << std::endl << TO_RIGHT << "All possible moves:" << std::endl;
}
}
} while(c.GameOver());
exit(0);
}
do { // player vs player (no bots)
c.PrintBoard();
while(c.PlayersTurn());
} while(c.GameOver());
}