You are on page 1of 1

#include <stdio.

h>
#include "TicTacToe.h"
#define _CRT_SECURE_NO_WARNINGS

void main()
{
char inp[2];

init(); //initialisiert das Spiel - llama funcion init(limpia el tablero)


int gameState = GAME_RUNNING;
int found;
while (gameState == GAME_RUNNING)
{
showBoard(); //llama función Showboard (dibuja el tablero)
found = 0;
do
{
if (found != 0)
{
printf("Invalid input. Try again!\n");
}
printf("Ihr Zug: ");
scanf("%s", inp);
found++;
}
while (checkInput(inp[0], inp[1]) != INP_OK);

setPlayerSymbol(inp[0], inp[1]);
gameState = getGameState(SYMBOL_P1);
if (gameState != GAME_RUNNING)
{
break; //beende das Spiel
}

setComputerSymbol_Random(); //Antwort des Programm!!


gameState = getGameState(SYMBOL_P2);
if (gameState != GAME_RUNNING)
break;
}

showBoard();

if (gameState == GAME_P1_WON)
printf("Player 1 WON!!");
if (gameState == GAME_P2_WON)
printf("Player 2 WON!!");
if (gameState == GAME_DRAW)
printf("Finished. It´s a draw!!");

scanf("%s", inp);
/*setBoardPlay(row, col);
*/
}

You might also like