Created
March 11, 2013 02:38
-
-
Save pauldwhitman/5131556 to your computer and use it in GitHub Desktop.
Part of the "Chess in C" blog post series. Updated board drawing code to draw potential moves.
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 POTENTIAL_MOVE_KING: printf("+"); | |
break; | |
case POTENTIAL_MOVE_QUEEN: printf("+"); | |
break; | |
case POTENTIAL_MOVE_ROOK: printf("+"); | |
break; | |
case POTENTIAL_MOVE_KNIGHT: printf("+"); | |
break; | |
case POTENTIAL_MOVE_BISHOP: printf("+"); | |
break; | |
case POTENTIAL_MOVE_PAWN: printf("+"); | |
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