Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- #include <math.h>
- #include <string>
- #include <windows.h>
- #define nLines 7
- #define defColor 15
- #define Black 0
- #define DarkBlue 1
- #define DarkGreen 2
- #define LightBlue 3
- #define DarkRed 4
- #define Magenta 5
- #define Orange 6
- #define LightGray 7
- #define Gray 8
- #define Blue 9
- #define Green 10
- #define Cyan 11
- #define Red 12
- #define Pink 13
- #define Yellow 14
- #define White 15
- #define uc unsigned char
- using namespace std;
- const int maxsizeM = 10;
- const int nSym = 4;
- const int s = 2 * maxsizeM * (maxsizeM + 1);
- const char sym[nSym] = { ' ' , 'X' , 'O' , '|' };
- class coord {
- public:
- int x;
- int y;
- };
- class coordMass {
- public:
- int x[s];
- int y[s];
- int val[s];
- int vsVal[s];
- int rept[s];
- };
- struct ASTR {
- string* str;
- uc color;
- int sizeM;
- ASTR(int a, string* b, int c) {
- sizeM = a;
- str = b;
- color = c;
- }
- };
- struct SYMBOL {
- uc color;
- char text;
- SYMBOL() {
- color = defColor;
- }
- SYMBOL(uc c, uc t) {
- color = c;
- text = t;
- }
- };
- struct PICTURE {
- int width;
- int height;
- SYMBOL** symbols;
- PICTURE(int h, int w) {
- width = w;
- height = h;
- symbols = new SYMBOL * [h];
- for (int i = 0; i < h; i++) {
- symbols[i] = new SYMBOL[w];
- }
- }
- };
- struct COOR {
- int x;
- int y;
- COOR() {
- x = 0;
- y = 0;
- }
- };
- struct ACOOR {
- COOR* data;
- int sizeM;
- int pos;
- ACOOR(int a) {
- sizeM = a;
- data = new COOR[sizeM];
- pos = -1;
- }
- void add(int x, int y) {
- pos++;
- data[pos].x = x;
- data[pos].y = y;
- }
- };
- struct CELL {
- int import;
- int type;
- int rept;
- CELL() {
- import = -2;
- type = 2;
- rept = -1;
- }
- };
- struct DATAU {
- int prob[4][2];
- int count;
- int** value;
- CELL cell;
- void create(int cPlayer) {
- value = new int* [4];
- for (int i = 0; i < 4; i++) {
- value[i] = new int[cPlayer + 1];
- prob[i][0] = prob[i][1] = -2;
- for (int j = 0; j <= cPlayer; j++) {
- value[i][j] = 0;
- }
- }
- count = 0;
- }
- };
- struct DATA {
- DATAU** data;
- int cPlayer;
- int msizeM;
- DATA(int a, int b) {
- cPlayer = a;
- msizeM = b;
- data = new DATAU * [msizeM];
- for (int i = 0; i < msizeM; i++) {
- data[i] = new DATAU[msizeM];
- for (int j = 0; j < msizeM; j++) {
- data[i][j].create(cPlayer);
- }
- }
- }
- void add(int x, int y, int count, int player) {
- if (count > data[x][y].count) {
- data[x][y].count = count;
- }
- data[x][y].value[count][player]++;
- }
- };
- struct MAP {
- int** value;
- int msizeM;
- MAP(int sizeM) {
- msizeM = sizeM;
- value = new int* [msizeM];
- for (int i = 0; i < msizeM; i++) {
- value[i] = new int[msizeM];
- }
- CLEAR();
- }
- void CLEAR() {
- for (int i = 0; i < msizeM; i++) {
- for (int j = 0; j < msizeM; j++) {
- value[i][j] = 0;
- }
- }
- }
- };
- void printPicture(PICTURE picture, bool newLine) {
- HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- for (int x = 0; x < picture.height; x++) {
- for (int y = 0; y < picture.width; y++) {
- SetConsoleTextAttribute(hConsole, picture.symbols[x][y].color);
- cout << picture.symbols[x][y].text;
- }
- if (newLine == true) {
- cout << endl;
- }
- }
- SetConsoleTextAttribute(hConsole, defColor);
- }
- int isMax(int a, int b) {
- return a == max(a, b);
- }
- bool isMaxCell(CELL a, CELL b) {
- if (a.import > b.import || a.import == b.import && a.type < b.type || a.import == b.import && a.type == b.type && a.rept > b.rept) {
- return true;
- }
- return false;
- }
- CELL getMaxCell(DATA data) {
- CELL cell;
- for (int x = 0; x < data.msizeM; x++) {
- for (int y = 0; y < data.msizeM; y++) {
- if (isMaxCell(data.data[x][y].cell, cell)) {
- cell = data.data[x][y].cell;
- }
- }
- }
- return cell;
- }
- bool isEqualCells(CELL a, CELL b) {
- if (a.import == b.import && a.rept == b.rept && a.type == b.type) {
- return true;
- }
- return false;
- }
- int countInData(DATA data, CELL maxCell) {
- int count = 0;
- for (int x = 0; x < data.msizeM; x++) {
- for (int y = 0; y < data.msizeM; y++) {
- if (isEqualCells(data.data[x][y].cell, maxCell)) {
- count++;
- }
- }
- }
- return count;
- }
- ACOOR getMaxData(DATA data) {
- CELL maxCell = getMaxCell(data);
- ACOOR coords(countInData(data, maxCell));
- for (int x = 0; x < data.msizeM; x++) { //add all coord
- for (int y = 0; y < data.msizeM; y++) {
- if (isEqualCells(data.data[x][y].cell, maxCell)) {
- coords.add(x, y);
- }
- }
- }
- return coords;
- }
- int random(int a) {
- return round((a - 1) * (double)(rand() % 100) / 100);
- }
- COOR getRandomCoord(ACOOR coords) {
- srand(time(NULL));
- return coords.data[random(coords.sizeM)];
- }
- DATA calc(MAP map, int player, int cPlayer) {
- DATA data(cPlayer, map.msizeM);
- for (int x = 0; x < map.msizeM; x++) {
- for (int y = 0; y < map.msizeM; y++) {
- if (map.value[x][y] == 0) {
- for (int a = 0; a < map.msizeM; a++) { //calc value
- data.add(x, y, 0, map.value[a][y]);
- data.add(x, y, 1, map.value[x][a]);
- if (x == y) {
- data.add(x, y, 2, map.value[a][a]);
- }
- if (x == map.msizeM - (y + 1)) {
- data.add(x, y, 2 + (x == y), map.value[a][map.msizeM - (a + 1)]);
- }
- }
- for (int i = 0; i <= data.data[x][y].count; i++) { //calc prob
- data.data[x][y].prob[i][0] = data.data[x][y].prob[i][1] = -1;
- if (data.data[x][y].value[i][player] == map.msizeM - data.data[x][y].value[i][0]) {
- data.data[x][y].prob[i][0] = data.data[x][y].value[i][player];
- }
- for (int j = 1; j <= cPlayer; j++) {
- if (j != player && data.data[x][y].value[i][j] == map.msizeM - data.data[x][y].value[i][0]) {
- data.data[x][y].prob[i][1] = data.data[x][y].value[i][j];
- break;
- }
- }
- for (int j = 0; j < 2; j++) { //calc rept
- data.data[x][y].cell.rept += (data.data[x][y].prob[i][j] > -1);
- }
- //calc import and type
- if (max(data.data[x][y].prob[i][0], data.data[x][y].prob[i][1]) > data.data[x][y].cell.import || (max(data.data[x][y].prob[i][0], data.data[x][y].prob[i][1]) == data.data[x][y].cell.import && data.data[x][y].prob[i][0] >= data.data[x][y].prob[i][1])) {
- data.data[x][y].cell.import = max(data.data[x][y].prob[i][0], data.data[x][y].prob[i][1]);
- data.data[x][y].cell.type = !isMax(data.data[x][y].prob[i][0], data.data[x][y].prob[i][1]);
- }
- }
- }
- }
- }
- return data;
- }
- PICTURE convert(ASTR s) {
- PICTURE picture(s.sizeM, s.str[0].length());
- for (int i = 0; i < s.sizeM; i++) {
- for (int j = 0; j < s.str[0].length(); j++) {
- picture.symbols[i][j].text = s.str[i][j];
- if (s.str[i][j] != ' ') {
- picture.symbols[i][j].color = s.color;
- }
- }
- }
- return picture;
- }
- ASTR convertS(int color, initializer_list<string> sl) {
- string* s = new string[sl.size()];
- int i = 0;
- for (string si : sl) {
- s[i] = si;
- i++;
- }
- ASTR as(sl.size(), s, color);
- return as;
- }
- PICTURE null[nLines] = { convert(convertS(defColor, {
- { " "}
- })), convert(convertS(defColor, {
- { " ~~~~~~ "}
- })), convert(convertS(defColor, {
- { " ~~~~~~ "}
- })), convert(convertS(defColor, {
- { " ~~~~~~ "}
- })), convert(convertS(defColor, {
- { " ~~~~~~ "}
- })), convert(convertS(defColor, {
- { " ~~~~~~ "}
- })), convert(convertS(defColor, {
- { " "}
- })) };
- PICTURE cross[nLines] = { convert(convertS(Green, {
- { " "}
- })), convert(convertS(Green, {
- { " $$ $$ "}
- })), convert(convertS(Green, {
- { " $$$$ "}
- })), convert(convertS(Green, {
- { " $$ " }
- })), convert(convertS(Green, {
- { " $$$$ " }
- })), convert(convertS(Green, {
- { " $$ $$ " }
- })), convert(convertS(Green, {
- { " " }
- })) };
- PICTURE naught[nLines] = { convert(convertS(Red, {
- { " "}
- })), convert(convertS(Red, {
- { " $$$$ "}
- })), convert(convertS(Red, {
- { " $$ $$ "}
- })), convert(convertS(Red, {
- { " $$ $$ " }
- })), convert(convertS(Red, {
- { " $$ $$ " }
- })), convert(convertS(Red, {
- { " $$$$ " }
- })), convert(convertS(Red, {
- { " " }
- })) };
- void printMap(MAP map) {
- for (int x = 0; x < map.msizeM; x++) {
- for (int i = 0; i < nLines; i++) {
- for (int y = 0; y < map.msizeM; y++) {
- if (map.value[x][y] == 1) {
- printPicture(cross[i], false);
- }
- if (map.value[x][y] == 2) {
- printPicture(naught[i], false);
- }
- if (map.value[x][y] == 0) {
- printPicture(null[i], false);
- }
- }
- cout << endl;
- }
- }
- }
- PICTURE welcome = convert(convertS(Blue, {
- { " $$ $ $$$$$ $$ $$$$ $$$$ $$ $$ $$$$$ "},
- { " $$ $ $$ $$ $$ $$ $$ $$ $$$ $$$ $$ "},
- { " $$ $ $ $$$$ $$ $$ $$ $$ $$ $ $$ $$$$ "},
- { " $$$$$$ $$ $$ $$ $$ $$ $$ $$ $$ $$ "},
- { " $$ $$ $$$$$ $$$$$$ $$$$ $$$$ $$ $$ $$$$$ "},
- { " "},
- { " $$$$$$ $$$$$$ $$$$ $$$$$$ $$$$ $$$$ $$$$$$ $$$$ $$$$$ "},
- { " $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ "},
- { " $$ $$ $$ $$ $$$$$$ $$ $$ $$ $$ $$$$ "},
- { " $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ "},
- { " $$ $$$$$$ $$$$ $$ $$ $$ $$$$ $$ $$$$ $$$$$ "},
- { " "},
- { "$$$$$ $$ $$ $$ $$ $$ $$$$ $$$$$ $$$$$$ $$$$ $$ $$$$ $$ $$ $$$$$ "},
- { "$$ $$ $$$$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ "},
- { "$$$$$ $$ $$ $$ $$ $$$$$$ $$ $$ $$ $$$$ $$ $$$$$$ $$ $$ $$$$$ "},
- { "$$ $$ $$ $$$$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$ $$$$ $$ $$ "},
- { "$$$$$ $$ $$ $$$$$$ $$ $$ $$$$$ $$$$$$ $$$$ $$$$$$ $$ $$ $$ $$$$$ $$"}
- }));
- int sizeM = 3;
- int map[maxsizeM][maxsizeM];
- int x, y;
- int player, type;
- coord move;
- char a;
- char b[5];
- void ClearMap() {
- int i, j;
- for (i = 0; i < sizeM; i++)
- for (j = 0; j < sizeM; j++)
- map[i][j] = 0;
- }
- int vs(int player) {
- if (player == 1)
- return 2;
- if (player == 2)
- return 1;
- }
- coord CalcMove(int player) {
- coord PlayerMove;
- int nMove = 0, nMoveRept = 0;
- coordMass mMove, mMoveRept;
- int i, j, n, vsN, x, y;
- int valMax = 0, vsValMax = 0;
- int reptMax = 0, nMax = 0;
- int rpos;
- srand(time(NULL));
- for (i = 0; i < sizeM; i++) {
- n = 0;
- vsN = 0;
- for (j = 0; j < sizeM; j++) {
- if (map[i][j] == player)
- n += 1;
- if (map[i][j] == vs(player))
- vsN += 1;
- mMove.x[sizeM * nMove + j] = i;
- mMove.y[sizeM * nMove + j] = j;
- }
- for (j = 0; j < sizeM; j++)
- if (map[i][j] == 0) {
- mMove.val[sizeM * nMove + j] = n;
- mMove.vsVal[sizeM * nMove + j] = vsN;
- }
- else {
- mMove.val[sizeM * nMove + j] = -1;
- mMove.vsVal[sizeM * nMove + j] = -1;
- }
- nMove += 1;
- }
- for (j = 0; j < sizeM; j++) {
- n = 0;
- vsN = 0;
- for (i = 0; i < sizeM; i++) {
- if (map[i][j] == player)
- n += 1;
- if (map[i][j] == vs(player))
- vsN += 1;
- mMove.x[sizeM * nMove + i] = i;
- mMove.y[sizeM * nMove + i] = j;
- }
- for (i = 0; i < sizeM; i++)
- if (map[i][j] == 0) {
- mMove.val[sizeM * nMove + i] = n;
- mMove.vsVal[sizeM * nMove + i] = vsN;
- }
- else {
- mMove.val[sizeM * nMove + i] = -1;
- mMove.vsVal[sizeM * nMove + i] = -1;
- }
- nMove += 1;
- }
- for (j = 0; j <= 1; j++) {
- n = 0;
- vsN = 0;
- for (i = 0; i < sizeM; i++) {
- x = i;
- y = (j * 2 - 1) * (j * (sizeM - 1) - i);
- if (map[x][y] == player)
- n += 1;
- if (map[x][y] == vs(player))
- vsN += 1;
- mMove.x[sizeM * nMove + i] = x;
- mMove.y[sizeM * nMove + i] = y;
- }
- for (i = 0; i < sizeM; i++) {
- x = i;
- y = (j * 2 - 1) * (j * (sizeM - 1) - i);
- if (map[x][y] == 0) {
- mMove.val[sizeM * nMove + i] = n;
- mMove.vsVal[sizeM * nMove + i] = vsN;
- }
- else {
- mMove.val[sizeM * nMove + i] = -1;
- mMove.vsVal[sizeM * nMove + i] = -1;
- }
- }
- nMove += 1;
- }
- nMove *= sizeM;
- for (i = 0; i < s; i++)
- mMoveRept.rept[i] = 0;
- for (i = 0; i < nMove; i++)
- if (mMove.val[i] != 0 and mMove.vsVal[i] != 0)
- mMove.val[i] = -1;
- for (i = 0; i < nMove; i++) {
- if (mMove.val[i] != -1)
- for (j = 0; j <= nMoveRept; j++) {
- if (mMove.x[i] != -1 and mMove.x[i] == mMoveRept.x[j] and mMove.y[i] == mMoveRept.y[j] and mMove.val[i] == mMoveRept.val[j] and mMove.vsVal[i] == mMoveRept.vsVal[j]) {
- mMoveRept.rept[j] += 1;
- mMove.x[i] = -1;
- break;
- }
- }
- if (mMove.val[i] != -1 and mMove.x[i] != -1) {
- mMoveRept.x[nMoveRept] = mMove.x[i];
- mMoveRept.y[nMoveRept] = mMove.y[i];
- mMoveRept.val[nMoveRept] = mMove.val[i];
- mMoveRept.vsVal[nMoveRept] = mMove.vsVal[i];
- mMoveRept.rept[nMoveRept] += 1;
- nMoveRept += 1;
- mMove.x[i] = -1;
- }
- }
- for (i = 0; i < nMoveRept; i++) {
- if (mMoveRept.val[i] > valMax)
- valMax = mMoveRept.val[i];
- if (mMoveRept.vsVal[i] > vsValMax)
- vsValMax = mMoveRept.vsVal[i];
- }
- if (valMax >= vsValMax) {
- for (i = 0; i < nMoveRept; i++)
- if (mMoveRept.val[i] == valMax and mMoveRept.rept[i] > reptMax)
- reptMax = mMoveRept.rept[i];
- vsValMax = 0;
- }
- else {
- for (i = 0; i < nMoveRept; i++)
- if (mMoveRept.vsVal[i] == vsValMax and mMoveRept.rept[i] > reptMax)
- reptMax = mMoveRept.rept[i];
- valMax = 0;
- }
- for (i = 0; i < nMoveRept; i++)
- if (mMoveRept.val[i] == valMax and mMoveRept.vsVal[i] == vsValMax and mMoveRept.rept[i] == reptMax)
- nMax += 1;
- rpos = random(nMax);
- i = 0;
- while (rpos > 0) {
- if (mMoveRept.val[i] == valMax and mMoveRept.vsVal[i] == vsValMax and mMoveRept.rept[i] == reptMax)
- rpos -= 1;
- i += 1;
- }
- rpos = i - 1;
- if (nMoveRept > 0) {
- PlayerMove.x = mMoveRept.x[rpos];
- PlayerMove.y = mMoveRept.y[rpos];
- }
- else {
- n = 0;
- for (i = 0; i < sizeM; i++)
- for (j = 0; j < sizeM; j++)
- if (map[i][j] == 0)
- n += 1;
- rpos = random(n);
- for (i = 0; i < sizeM; i++)
- for (j = 0; j < sizeM; j++)
- if (map[i][j] == 0) {
- rpos -= 1;
- if (rpos == 0) {
- PlayerMove.x = i;
- PlayerMove.y = j;
- break;
- }
- }
- }
- return PlayerMove;
- }
- int CheckGame() {
- int i, j, nPlayer, nVsPlayer, stat = 0, x, y, player = 1;
- for (i = 0; i < sizeM; i++) {
- nPlayer = 0;
- nVsPlayer = 0;
- for (j = 0; j < sizeM; j++)
- if (map[i][j] == player)
- nPlayer += 1;
- else
- if (map[i][j] == vs(player))
- nVsPlayer += 1;
- if (nPlayer == sizeM) {
- stat = player;
- break;
- }
- if (nVsPlayer == sizeM) {
- stat = vs(player);
- break;
- }
- }
- if (stat == 0)
- for (j = 0; j < sizeM; j++) {
- nPlayer = 0;
- nVsPlayer = 0;
- for (i = 0; i < sizeM; i++)
- if (map[i][j] == player)
- nPlayer += 1;
- else
- if (map[i][j] == vs(player))
- nVsPlayer += 1;
- if (nPlayer == sizeM) {
- stat = player;
- break;
- }
- if (nVsPlayer == sizeM) {
- stat = vs(player);
- break;
- }
- }
- if (stat == 0)
- for (j = 0; j <= 1; j++) {
- nPlayer = 0;
- nVsPlayer = 0;
- for (i = 0; i < sizeM; i++) {
- x = i;
- y = (j * 2 - 1) * (j * (sizeM - 1) - i);
- if (map[x][y] == player)
- nPlayer += 1;
- if (map[x][y] == vs(player))
- nVsPlayer += 1;
- }
- if (nPlayer == sizeM) {
- stat = player;
- break;
- }
- if (nVsPlayer == sizeM) {
- stat = vs(player);
- break;
- }
- }
- if (stat == 0) {
- x = 0;
- for (i = 0; i < sizeM; i++)
- for (j = 0; j < sizeM; j++)
- if (map[i][j] != 0)
- x += 1;
- if (x == sizeM * sizeM)
- stat = 3;
- }
- return stat;
- }
- MAP cToMap(int m[maxsizeM][maxsizeM], int sizeM) {
- MAP map(sizeM);
- for (int x = 0; x < map.msizeM; x++) {
- for (int y = 0; y < map.msizeM; y++) {
- map.value[x][y] = m[x][y];
- }
- }
- return map;
- }
- int main() {
- HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
- printPicture(welcome, true);
- while (1) {
- printf("\nSelect a size of game (min 3 , max 10) :\n");
- do {
- scanf_s("%i", &sizeM);
- if (not (sizeM >= 3 and sizeM <= 10))
- printf("Eror!\n");
- } while (not (sizeM >= 3 and sizeM <= 10));
- system("cls");
- printf("Select a type of game :\n");
- printf("1 - game with computer\n");
- printf("2 - game with friend\n");
- do {
- scanf_s("%i", &type);
- if (not (type >= 1 and type <= 2))
- printf("Eror!\n");
- } while (not (type >= 1 and type <= 2));
- system("cls");
- if (type == 1) {
- printf("Select a cross or toe :\n");
- printf("1 - cross\n");
- printf("2 - toe\n");
- do {
- scanf_s("%i", &player);
- if (not (player >= 1 and player <= 2))
- printf("Eror!\n");
- } while (not (player >= 1 and player <= 2));
- system("cls");
- }
- ClearMap();
- while (CheckGame() == 0) {
- if (type == 2) {
- printMap(cToMap(map, sizeM));
- printf("Cross move:\n");
- do {
- scanf_s("%i %i", &x, &y);
- if (not (x >= 1 and x <= sizeM and y >= 1 and y <= sizeM and map[x - 1][y - 1] == 0))
- printf("Eror!\n");
- } while (not (x >= 1 and x <= sizeM and y >= 1 and y <= sizeM and map[x - 1][y - 1] == 0));
- map[x - 1][y - 1] = 1;
- if (CheckGame() != 0) {
- break;
- }
- else
- system("cls");
- printMap(cToMap(map, sizeM));
- printf("Toe move:\n");
- do {
- scanf_s("%i %i", &x, &y);
- if (not (x >= 1 and x <= sizeM and y >= 1 and y <= sizeM and map[x - 1][y - 1] == 0))
- printf("Eror!\n");
- } while (not (x >= 1 and x <= sizeM and y >= 1 and y <= sizeM and map[x - 1][y - 1] == 0));
- map[x - 1][y - 1] = 2;
- if (CheckGame() != 0) {
- break;
- }
- else
- system("cls");
- }
- if (type == 1 and player == 2) {
- COOR move = getRandomCoord(getMaxData(calc(cToMap(map, sizeM), vs(player), 2)));
- //move = CalcMove(vs(player));
- map[move.x][move.y] = vs(player);
- if (CheckGame() != 0) {
- break;
- }
- }
- if (type == 1) {
- printMap(cToMap(map, sizeM));
- printf("Your move :\n");
- do {
- scanf_s("%i %i", &x, &y);
- if (not (x >= 1 and x <= sizeM and y >= 1 and y <= sizeM and map[x - 1][y - 1] == 0))
- printf("Eror!\n");
- } while (not (x >= 1 and x <= sizeM and y >= 1 and y <= sizeM and map[x - 1][y - 1] == 0));
- map[x - 1][y - 1] = player;
- if (CheckGame() != 0) {
- break;
- }
- else
- system("cls");
- }
- if (type == 1 and player == 1) {
- COOR move = getRandomCoord(getMaxData(calc(cToMap(map, sizeM), vs(player), 2)));
- //move = CalcMove(vs(player));
- map[move.x][move.y] = vs(player);
- if (CheckGame() != 0) {
- break;
- }
- }
- }
- system("cls");
- printMap(cToMap(map, sizeM));
- if (type == 1 and CheckGame() == player)
- printf("You win!\n");
- else
- if (type == 1 and CheckGame() == vs(player))
- printf("You lose!\n");
- if (type == 2) {
- if (CheckGame() == 1)
- printf("Cross win!\n");
- if (CheckGame() == 2)
- printf("Toe win!\n");
- }
- if (CheckGame() == 3)
- printf("Draw!\n");
- printf("Do you want to try again ?\n");
- printf("Print Yes to continue\n");
- scanf_s("%s", &b);
- if (not (b[0] == 'Y' and b[1] == 'e' and b[2] == 's'))
- break;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment