|
|
@ -8,7 +8,7 @@ void printBoard(); |
|
|
|
|
|
|
|
struct ticTacToe GAME; |
|
|
|
|
|
|
|
struct command COMMANDS[MAX_COMMANDS] = { |
|
|
|
struct usrCommand COMMANDS[MAX_COMMANDS] = { |
|
|
|
{ 1, "\"start menu\" - startet das menu", startMenu}, |
|
|
|
{ 2, "\"start game\" - startet das spiel", startGame} |
|
|
|
}; |
|
|
@ -21,12 +21,12 @@ void startTicTacToe(){ |
|
|
|
GAME = createTicTacToe(); |
|
|
|
|
|
|
|
while( GAME.currentState != -1 ){ |
|
|
|
commandFunction command; |
|
|
|
commandFunction usrCommand; |
|
|
|
printf("search command!\n"); |
|
|
|
command = getCommandById( GAME.currentState + 1); |
|
|
|
usrCommand = getCommandById( GAME.currentState + 1); |
|
|
|
|
|
|
|
if( command != NULL) |
|
|
|
command(0); |
|
|
|
if( usrCommand != NULL) |
|
|
|
usrCommand(0); |
|
|
|
else{ |
|
|
|
printf("command not found"); |
|
|
|
return; |
|
|
@ -105,7 +105,7 @@ int handleGameInput( char* input ){ |
|
|
|
} |
|
|
|
|
|
|
|
int startMenu( int code ){ |
|
|
|
if( code == -1 ){ // command test |
|
|
|
if( code == -1 ){ // usrCommand test |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
@ -222,7 +222,7 @@ bool playerHasWon( bool board[BORAD_SIZE][BORAD_SIZE]){ |
|
|
|
} |
|
|
|
|
|
|
|
int startGame( int code ){ |
|
|
|
if( code == -1 ){ // command test |
|
|
|
if( code == -1 ){ // usrCommand test |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
|