Created
April 3, 2016 20:41
-
-
Save slg123/cbaf1b8ab5eff862f8996656e728d621 to your computer and use it in GitHub Desktop.
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
void walk_board(int a[N][N]) { | |
knight_move moves[] = { 1,2, 2,1, 1,-2, 2,-1, -1,2, -2,1, -1,-2, -2,-1 }; | |
int x = 1; | |
int y = 1; | |
int m = 1; | |
while (m <= 64) { | |
for (int i=0; i<sizeof(moves)/sizeof(moves[0]); i++) { | |
x = x+moves[i].x; | |
y = y+moves[i].y; | |
a[x][y] = m; | |
m++; | |
print_board(a); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
getting close to a knights tour in c. my knight just hangs out on the left side of the board, but the moves are working now.