Browse Source

added a function to print the game board

remotes/origin/georg
KaffeeMaus 11 months ago
parent
commit
b84ed1c00a
  1. 27
      src/main/c/Georg/tictactoe.c

27
src/main/c/Georg/tictactoe.c

@ -4,6 +4,8 @@
#include "tictactoe.h"
void printBoard();
struct ticTacToe GAME;
struct command COMMANDS[MAX_COMMANDS] = {
@ -114,6 +116,31 @@ int startMenu( int code ){
return 0;
}
void printBoard(){
for( int i = 0; i < BORAD_SIZE*4+1; i++ ){
printf("-");
}
printf("\n");
for (int i = 0; i < 3; ++i) {
printf("| ");
for (int j = 0; j < 3; ++j) {
if( GAME.board[i][j] == true )
printf( "X" );
else
printf ( " " );
printf(" | ");
}
printf( "\n" );
}
for( int i = 0; i < BORAD_SIZE*4+1; i++ ){
printf("-");
}
printf("\n");
}
int startGame( int code ){
if( code == -1 ){ // command test
return 1;

Loading…
Cancel
Save