-
Notifications
You must be signed in to change notification settings - Fork 0
/
Source.cpp
93 lines (89 loc) · 1.91 KB
/
Source.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
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
#include "global.h"
#include<windows.h>
int main()
{
HWND console = GetConsoleWindow();
RECT r;
GetWindowRect(console, &r); //stores the console's current dimensions
MoveWindow(console, r.left, r.top, 950, 650, TRUE);
board b;
int n = -1;
int vb = -1;
std::string str;
while (true)
{
n++;
bool ERR=false;
system("cls");
welcome();
if ((pow(-1, n)) == 1)
{
if (++vb)
{
inverse(P)
welcome();
}
jGreater:
b.show();
if (ERR)
{
system("cls");
welcome();
std::cout << std::endl << RED << "\t\t\t\t\tMovement not allowed! TRY AGAIN " << RESET << std::endl;
b.show();
}
jjGreater:
std::cout <<BLUE<< "\t\t\tPlayer 1 turn :"<<RESET;
getline(std::cin, str);
if(seek_help(str))
{
system("cls");
welcome();
b.show(help(str));
goto jjGreater ;
}
std::tuple<int_pair, int_pair> tup=Extract(str);
if(std::get<0>(tup)==std::make_pair(-1,-1))
goto jjGreater;
if (b.move(std::get<0>(tup), std::get<1>(tup)) == false)
{
ERR=true;
goto jGreater;
}
}
else if ((pow(-1, n)) == -1)
{
bool ERRR=false;
inverse(P)
iGreater:
system("cls");
welcome();
b.show();
if (ERRR)
{
system("cls");
welcome();
std::cout << std::endl << RED << "\t\t\t\t\tMovement not allowed! TRY AGAIN " << RESET << std::endl;
b.show();
}
iiGreater:
std::cout << PURPLE<<"\t\t\tPlayer 2 turn :"<<RESET;
getline(std::cin, str);
if (seek_help(str))
{
system("cls");
welcome();
b.show(help(str));
goto iiGreater;
}
std::tuple<int_pair, int_pair> tup = Extract(str);
if (std::get<0>(tup) == std::make_pair(-1, -1))
goto iiGreater;
if (b.move(std::get<0>(tup), std::get<1>(tup)) == false)
{
ERRR = true;
goto iGreater;
}
}
}
}