ount); } } if(flag == 0) chess[x][y]=0; return 0; } int main() { int i, j; for(i=0; i<X; i++) for(j=0; j<Y; j++) chess[i][j]=0; if(TravelChessBoard(2, 0, 1)) { for(i=0; i<X; i++) { for(j=0; j<Y; j++) printf("%-5d", chess[i][j]); printf("\n"); } printf("The horse has travelled the chess borad\n"); } else printf("The horse cannot travel the chess board\n"); return 0; }
运行结果:
43 50 47 38 57 52 61 32 48 37 44 51 46 33 58 53 1 42 49 56 39 60 31 62 36 15 40 45 34 29 54 59 41 2 35 16 55 24 63 30 14 5 12 9 22 19 28 25 3 10 7 20 17 26 23 64 6 13 4 11 8 21 18 27 The horse has travelled the chess borad
|