|
|
@ -4,7 +4,9 @@ |
|
|
|
|
|
|
|
#include "tictactoe.h" |
|
|
|
|
|
|
|
struct ticTacToe TICTACTOE; |
|
|
|
struct ticTacToe GAME; |
|
|
|
struct command* COMMANDS; |
|
|
|
|
|
|
|
|
|
|
|
char* getWelcomeMessage(){ |
|
|
|
return "Hallo und willkommen zu unserem TicTacToe Spiel. Anbei die Anleitung:\n"; |
|
|
@ -29,6 +31,8 @@ int handleCommand( char* input ){ |
|
|
|
return 0; |
|
|
|
}else if( strcmp(input, "start game") == 0 ){ |
|
|
|
return 1; |
|
|
|
}else{ |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -68,10 +72,20 @@ int startMenu( int code ){ |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
|
printf("Welcome to the menu!\n"); |
|
|
|
char userInput[50]; |
|
|
|
printf( ":" ); |
|
|
|
scanf( "%s", userInput ); |
|
|
|
while( GAME.currentState == 0 ){ |
|
|
|
char userInput[50]; |
|
|
|
printf( ":" ); |
|
|
|
scanf( "%s", &userInput ); |
|
|
|
|
|
|
|
int nextState = 0; |
|
|
|
nextState = handleCommand(userInput); |
|
|
|
|
|
|
|
if( nextState == -1 ){ |
|
|
|
printf("command not found!"); |
|
|
|
}else{ |
|
|
|
GAME.currentState = nextState; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|