Browse Source

refactoring: commend the start function

remotes/origin/georg
KaffeeMaus 11 months ago
parent
commit
558582a8ad
  1. 6
      src/main/c/Georg/tictactoe.c

6
src/main/c/Georg/tictactoe.c

@ -14,11 +14,11 @@ struct usrCommand COMMANDS[MAX_COMMANDS] = {
}; };
void startTicTacToe(){ void startTicTacToe(){
setbuf(stdout, 0);
setbuf(stdout, 0); // for debug output
printf( "%s\n", getWelcomeMessageTicTacToe() ); printf( "%s\n", getWelcomeMessageTicTacToe() );
printf( "%s\n\n", getRulesMessageTicTacToe() ); printf( "%s\n\n", getRulesMessageTicTacToe() );
GAME = createTicTacToe();
GAME = createTicTacToe(); // create the "game object"
while( GAME.currentState != -1 ){ while( GAME.currentState != -1 ){
commandFunction usrCommand; commandFunction usrCommand;
@ -26,7 +26,7 @@ void startTicTacToe(){
usrCommand = getCommandById( GAME.currentState + 1); usrCommand = getCommandById( GAME.currentState + 1);
if( usrCommand != NULL) if( usrCommand != NULL)
usrCommand(0);
usrCommand(0); // 0, for non test behavior
else{ else{
printf("command not found"); printf("command not found");
return; return;

Loading…
Cancel
Save