コード例 #1
0
ファイル: print.c プロジェクト: mewo2/corvax
void print_board() {
    int rank = 7;
    int file = 0;
    plog("  abcdefgh\n");
    for (int rank = 7; rank >= 0; rank--) {
        plog("%c ", '1' + rank);
        for (int file = 0; file < 8; file++) {
            square_t sq = SQUARE(rank, file);
            plog("%c", piece_chars[b.colors[sq]][b.pieces[sq]]);
        }
        plog(" %c\n", '1' + rank);
    }
    plog("  abcdefgh\n");
    plog("Castle: ");
    if (b.flags & CASTLE_WK) plog("K");
    if (b.flags & CASTLE_WQ) plog("Q");
    if (b.flags & CASTLE_BK) plog("k");
    if (b.flags & CASTLE_BQ) plog("q");
    plog("\nPawn counts:\n  ");
    for (int i = 0; i < 8; i++) {
        plog("%d", b.pawn_counts[WHITE][i]);
    }
    plog("\n  ");
    for (int i = 0; i < 8; i++) {
        plog("%d", b.pawn_counts[BLACK][i]);
    }
    plog("\n");
    print_fen();
    plog("\n");
}
コード例 #2
0
ファイル: statsp.c プロジェクト: chris-moreton/tb
void print_longest(FILE *F)
{
  if (lw_ply >= 0) {
    fprintf(F, "Longest win for white: %d ply; ", lw_ply);
    print_fen(lw_idx, lw_clr);
    fputs(fen_buf, F);
    if (lw_ply > glw_ply) {
      glw_ply = lw_ply;
      strcpy(glw_fen, fen_buf);
    }
  }
  if (lcw_ply >= 0) {
    fprintf(F, "Longest cursed win for white: %d ply; ", lcw_ply);
    print_fen(lcw_idx, lcw_clr);
    fputs(fen_buf, F);
    if (lcw_ply > glcw_ply) {
      glcw_ply = lcw_ply;
      strcpy(glcw_fen, fen_buf);
    }
  }
  if (lcb_ply >= 0) {
    fprintf(F, "Longest cursed win for black: %d ply; ", lcb_ply);
    print_fen(lcb_idx, lcb_clr);
    fputs(fen_buf, F);
    if (lcb_ply > glcb_ply) {
      glcb_ply = lcb_ply;
      strcpy(glcb_fen, fen_buf);
    }
  }
  if (lb_ply >= 0) {
    fprintf(F, "Longest win for black: %d ply; ", lb_ply);
    print_fen(lb_idx, lb_clr);
    fputs(fen_buf, F);
    if (lb_ply > glb_ply) {
      glb_ply = lb_ply;
      strcpy(glb_fen, fen_buf);
    }
  }
  fprintf(F, "\n");
}