Created
March 10, 2013 11:00
-
-
Save pauldwhitman/5128146 to your computer and use it in GitHub Desktop.
Part of the "Chess in C" blog post series. The first iteration of the board printing code.
This file contains hidden or 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
/* Print the board */ | |
/* For every row */ | |
for (i = 0;i <= 7; i++) { | |
/* And every column */ | |
for (j = 0;j <= 7; j++){ | |
/* Get the board value */ | |
boardValue = board[i][j]; | |
/* And print the contents */ | |
switch (boardValue) { | |
case EMPTY: printf("."); | |
break; | |
case KING: printf("K"); | |
break; | |
case QUEEN: printf("Q"); | |
break; | |
case ROOK: printf("R"); | |
break; | |
case KNIGHT: printf("N"); | |
break; | |
case BISHOP: printf("B"); | |
break; | |
case PAWN: printf("P"); | |
break; | |
case BREADCRUMB: printf("+"); | |
break; | |
} | |
} | |
/* At the end of each row, make a new line */ | |
printf("\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment