Skip to content

Instantly share code, notes, and snippets.

@Marken-Foo
Marken-Foo / CSA_standard.md
Created December 19, 2020 14:19
Shogi CSA file standard

CSA standard kifu file format

This document is a translation of the original Japanese text at http://www2.computer-shogi.org/protocol/record_v22.html on 2020-12-19 by Marken Foo.

  • 1991-03-08 original draft by Kakinoki Yoshikazu
  • 1991-03-09 discussed by the Computer Shogi Association (CSA)
  • 1991-05-11 1st Edition accepted by the CSA
  • 1997-08-25 3rd Edition accepted by CSA board
    • %KACHI, %HIKIWAKE added
  • 2002-11-15 4th Edition accepted by CSA board
@Marken-Foo
Marken-Foo / KIF_standard.md
Created December 19, 2020 14:18
Shogi KIF file standard

Kifu file KIF format

This document is a translation of the original Japanese text at http://kakinoki.o.oo7.jp/kif_format.html on 2020-11-11 by Marken Foo.

  • 2020/11/11 translated to English
  • 2020/11/25 added translated tsumeshogi sample headers

Summary

The KIF file format used by programs like Kakinoki Shogi and "Kifu for Series" is a text file format described below.

@Marken-Foo
Marken-Foo / zhume_fen.py
Created July 16, 2020 10:49
Command-line python script to complete crazyhouse FEN by giving black all unused pieces in hand
# === FENify tsumehouse ===
# Takes a crazyhouse FEN containing just board position and command-line
# argument for white hand pieces, and outputs correct FEN where black has all
# the remaining pieces in hand.
#
# --- Example ---
# Input: "4r3/5k2/5pp1/5N2/8/8/8/8[] w - - 0 1" "BQ"
# Output: "4r3/5k2/5pp1/5N2/8/8/8/8[QBqrrrbbbnnnpppppppppppppp] w - - 0 1"
# (this is a 3te crazyhouse tsume)
@Marken-Foo
Marken-Foo / sfen_to_latex.py
Last active April 20, 2020 16:21
Script to convert file containing shogi SFENs to commands for LaTeX rendering
# === SFEN-to-LaTeX-tsumeshogi-converter ===
# Just a quick and dirty conversion of SFEN notation from a file into LaTeX
# commands for rendering using the myshogi.sty package.
# Specifically, assumes the SFEN from the "Sfen" copy option of ShogiGUI.
# Example of SFEN line:
# position sfen 3sks3/9/4S4/9/1B7/9/+p+l+n+sg+b+r1K/9/9 b r3g3n3l17p 1 moves
# Example of desired output (tsume mode):
#
@Marken-Foo
Marken-Foo / atomic_perft_suite.epd
Last active January 21, 2020 17:21
A collection of perft values for atomic chess. Many positions from Roman Hartmann's (rocechess.ch/rocee.html) collection of regular chess perft values. (Note: castling convention used is that castling is allowed if squares that the king passes through are not attacked *while the king is on its original square*.)
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 ;D1 20 ;D2 400 ;D3 8902 ;D4 197326 ;D5 4864979 ;D6 118926425
r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1 ;D1 48 ;D2 1939 ;D3 88298 ;D4 3492097 ;D5 153516309
rn2kb1r/1pp1p2p/p2q1pp1/3P4/2P3b1/4PN2/PP3PPP/R2QKB1R b KQkq - 0 1 ;D1 40 ;D2 1238 ;D3 45237 ;D4 1434825 ;D5 50504249
rn1qkb1r/p5pp/2p5/3p4/N3P3/5P2/PPP4P/R1BQK3 w Qkq - 0 1 ;D1 28 ;D2 833 ;D3 23353 ;D4 714499 ;D5 21134061
8/8/8/8/5p1p/4pP1P/4P2K/5BNk w - - 0 1 ;D1 2 ;D2 1 ;D3 2 ;D4 4 ;D5 10 ;D6 22 ;D7 67 ;D8 132 ;D9 492 ;D10 1096 ;D11 5157 ;D12 13063 ;D13 79376 ;D14 268898 ;D15 1881806
5bnK/4p2k/4Pp1p/5P1P/8/8/8/8 b - - 0 1 ;D1 2 ;D2 1 ;D3 2 ;D4 4 ;D5 10 ;D6 22 ;D7 67 ;D8 132 ;D9 492 ;D10 1096 ;D11 5157 ;D12 13063 ;D13 79376 ;D14 268898 ;D15 1881806
8/8/8/8/8/1p1p1p1p/1PpPkPpP/2BbK2R w K - 0 1 ;D1 4 ;D2 14 ;D3 22 ;D4 69 ;D5 133 ;D6 979 ;D7 3595 ;D8 46827 ;D9 347327
8/8/8/8/8/8/4kr2/4K2R w K - 0 1 ;D1 13 ;D2 184 ;D3 2591 ;D4 44811 ;D5 693481 ;D6 12230636
8/8/8/8/8/8/4kq2/4K2