static void board_print(int cid, struct chess *chess) { unsigned char x; int y, start, end, step; assert(chess->ids[0] == cid || chess->ids[1] == cid); if (chess->ids[0] == cid) { start = 7; end = -1; step = -1; } else { start = 0; end = 8; step = 1; } for (y = start; y != end; y += step) { cprintf(cid, "%d ", y + 1); for (x = 0; x < 8; x++) piece_print(cid, chess->board[x][y]); cprintf(cid, "\n"); } cprintf(cid, " a b c d e f g h\n"); return; }
void solution_print(solution_t *s) { int i,j; printf("------------------------------------\nSOLUTION matches %d\n\n",s->matches); for (i=0;i<s->n;i++) { printf(" | "); for (j=0;j<s->n;j++) { piece_print(s->mat[i][j]); printf(" | "); } printf("\n"); } printf("------------------------------------\n"); }
/** * @brief Prints a human-readable view of the current state in a file. * * The current piece, a view of the board and the game score are printed. * * @param out file to write, e.g. stdout * @param game the game */ void game_print(FILE *out, Game *game) { /* print the game pieces int i; fprintf(out, "Game pieces:\n"); for (i = 0; i < game->nb_pieces; i++) { fprintf(out, " Piece %d\n", i); print_piece_orientations(out, &game->pieces[i]); fprintf(out, "\n"); } */ fprintf(out, "Current piece:\n"); piece_print(out, game->current_piece); board_print(out, game->board); /* print_last_move_info(out, &game->last_move_info); */ fprintf(out, "Game score: %d\n", game->score); }