|
@ -156,12 +156,16 @@ int* getMarkerParameters( char* input ){ |
|
|
int firstArgument = input[index-1] - '0'; |
|
|
int firstArgument = input[index-1] - '0'; |
|
|
int secondArgument = input[index+1] - '0'; |
|
|
int secondArgument = input[index+1] - '0'; |
|
|
|
|
|
|
|
|
array[0] = firstArgument; |
|
|
|
|
|
array[1] = secondArgument; |
|
|
|
|
|
|
|
|
array[0] = firstArgument-1; |
|
|
|
|
|
array[1] = secondArgument-1; |
|
|
|
|
|
|
|
|
return array; |
|
|
return array; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void setBoardMarker( bool board[BORAD_SIZE][BORAD_SIZE], int* params ){ |
|
|
|
|
|
board[params[0]][params[1]] = 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void handleGame(){ |
|
|
void handleGame(){ |
|
|
char* input = getUserInput(); |
|
|
char* input = getUserInput(); |
|
|
int nextState = handleCommand( input ); |
|
|
int nextState = handleCommand( input ); |
|
@ -182,7 +186,9 @@ void handleGame(){ |
|
|
|
|
|
|
|
|
// gameCommand processing |
|
|
// gameCommand processing |
|
|
if( gameCommand == 1 ) { // set marker in field |
|
|
if( gameCommand == 1 ) { // set marker in field |
|
|
|
|
|
|
|
|
|
|
|
int* params = getMarkerParameters( input ); |
|
|
|
|
|
setBoardMarker( GAME.board, params ); |
|
|
|
|
|
free(params); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|