Created
February 13, 2016 04:56
-
-
Save RyanBreaker/5172940aaa4335f92747 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdbool.h> | |
char board[3][3]; | |
char pieces[] = {'A', 'B', 'C', '1', '2', '3', 'a', 'b', 'c'}; | |
// | |
void initialSetup() | |
{ | |
int piecesIndex = 0; | |
for (int i = 0; i < 3; i++) { | |
for (int j = 0; j < 3; j++) { | |
board[i][j] = pieces[piecesIndex++]; | |
} | |
} | |
} | |
// | |
void printBoard() | |
{ | |
printf("\n"); | |
printf("-------------------------\n"); | |
printf("Pieces available to play:\n"); | |
printf("\t%c %c %c \n", 'A', 'B', 'C'); | |
printf("\t%c %c %c \n", '1', '2', '3'); | |
printf("\t%c %c %c \n", 'a', 'b', 'c'); | |
printf("\n"); | |
printf(" ----------- \t Positions: \n"); | |
printf("| %c | %c | %c | \t 1 2 3 \n", board[0][0], board[0][1], board[0][2]); | |
printf("|-----------| \n"); | |
printf("| %c | %c | %c | \t 4 5 6 \n", board[1][0], board[1][1], board[1][2]); | |
printf("|-----------| \n"); | |
printf("| %c | %c | %c | \t 7 8 9 \n", board[2][0], board[2][1], board[2][2]); | |
printf(" ----------- \n"); | |
} | |
int main() | |
{ | |
char piece, position; | |
initialSetup(); | |
printBoard(); | |
while (true) { | |
scanf("%c%c", &piece, &position); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment