Introduction
Introduction Statistics Contact Development Disclaimer Help
initial stub for new castling tests - chess-puzzles - chess puzzle book generat…
git clone git://git.codemadness.org/chess-puzzles
Log
Files
Refs
README
LICENSE
---
commit bf941d069fdc94c7157de62e737e9f305a751b5b
parent 78e1ed61ec461637e664b9527f002e232f30ca6e
Author: Hiltjo Posthuma <[email protected]>
Date: Sat, 27 Jan 2024 20:22:18 +0100
initial stub for new castling tests
Diffstat:
M TODO | 5 +++++
M tests.sh | 153 +++++++++++++++++++++++++++++…
2 files changed, 158 insertions(+), 0 deletions(-)
---
diff --git a/TODO b/TODO
@@ -1,3 +1,8 @@
+- current castle tests are wrong,
+ UCI move: for castling is kingpos, rookpos.
+ test all possible chess960 and classical positions.
+ - castling code can be simplified and end position for castling is the same
+ as classical.
- rename fen.c to be more unique so it can be installed in $PATH.
- more tests.
- test more long sequence and halfmove and movenumber counts.
diff --git a/tests.sh b/tests.sh
@@ -14,6 +14,8 @@ testfen() {
output=$(./fen -o fen "$fen" "")
if test "$fen" != "startpos" && test "$fen" != "$output"; then
printf '[FEN] Fail: %s, input FEN does not match output FEN\n'…
+ printf '\texpected: %s\n' "$fen"
+ printf '\tgot: %s\n' "$output"
statuscode=1
failed=$((failed+1))
fi
@@ -610,3 +612,154 @@ else
fi
exit "$statuscode"
+
+# Test all castle positions for both sides for chess960
+# this includes classical positions.
+
+# TODO: also test PGN, should match O-O or O-O-O
+(IFS=" "
+while read -r kingside f kingpos r1pos r2pos; do
+ # test white kingside or queenside castle.
+ if test "$kingside" = "1"; then
+ fullfen="$f w Kk - 0 1"
+ expect="6kr/pppppppp/8/8/8/8/PPPPPPPP/5RK1 b k - 1 1"
+ move="${kingpos}1${r2pos}1"
+ else
+ fullfen="$f w Qq - 0 1"
+ expect="1r1k4/pppppppp/8/8/8/8/PPPPPPPP/2KR4 b q - 1 1"
+ move="${kingpos}1${r1pos}1"
+ fi
+ testfen "Chess960 position, $fullfen (white), $move" \
+ "$expect" \
+ "$fullfen" \
+ "$move"
+
+ # test black kingside or queenside castle.
+ if test "$kingside" = "1"; then
+ fullfen="$f b Kk - 0 1"
+ expect="5rk1/pppppppp/8/8/8/8/PPPPPPPP/6KR w K - 1 2"
+ move="${kingpos}8${r2pos}8"
+ else
+ fullfen="$f b Qq - 0 1"
+ expect="2kr4/pppppppp/8/8/8/8/PPPPPPPP/1R1K4 w Q - 1 2"
+ move="${kingpos}8${r1pos}8"
+ fi
+
+ testfen "Chess960 position, $fullfen (black), $move" \
+ "$expect" \
+ "$fullfen" \
+ "$move"
+done) <<!
+0 1r1k4/pppppppp/8/8/8/8/PPPPPPPP/1R1K4 d b e
+0 1r1k4/pppppppp/8/8/8/8/PPPPPPPP/1R1K4 d b f
+0 1r1k4/pppppppp/8/8/8/8/PPPPPPPP/1R1K4 d b g
+0 1r1k4/pppppppp/8/8/8/8/PPPPPPPP/1R1K4 d b h
+0 1r2k3/pppppppp/8/8/8/8/PPPPPPPP/1R2K3 e b f
+0 1r2k3/pppppppp/8/8/8/8/PPPPPPPP/1R2K3 e b g
+0 1r2k3/pppppppp/8/8/8/8/PPPPPPPP/1R2K3 e b h
+0 1r3k2/pppppppp/8/8/8/8/PPPPPPPP/1R3K2 f b g
+0 1r3k2/pppppppp/8/8/8/8/PPPPPPPP/1R3K2 f b h
+0 1r4k1/pppppppp/8/8/8/8/PPPPPPPP/1R4K1 g b h
+0 1rk5/pppppppp/8/8/8/8/PPPPPPPP/1RK5 c b d
+0 1rk5/pppppppp/8/8/8/8/PPPPPPPP/1RK5 c b e
+0 1rk5/pppppppp/8/8/8/8/PPPPPPPP/1RK5 c b f
+0 1rk5/pppppppp/8/8/8/8/PPPPPPPP/1RK5 c b g
+0 1rk5/pppppppp/8/8/8/8/PPPPPPPP/1RK5 c b h
+0 2r1k3/pppppppp/8/8/8/8/PPPPPPPP/2R1K3 e c f
+0 2r1k3/pppppppp/8/8/8/8/PPPPPPPP/2R1K3 e c g
+0 2r1k3/pppppppp/8/8/8/8/PPPPPPPP/2R1K3 e c h
+0 2r2k2/pppppppp/8/8/8/8/PPPPPPPP/2R2K2 f c g
+0 2r2k2/pppppppp/8/8/8/8/PPPPPPPP/2R2K2 f c h
+0 2r3k1/pppppppp/8/8/8/8/PPPPPPPP/2R3K1 g c h
+0 2rk4/pppppppp/8/8/8/8/PPPPPPPP/2RK4 d c e
+0 2rk4/pppppppp/8/8/8/8/PPPPPPPP/2RK4 d c f
+0 2rk4/pppppppp/8/8/8/8/PPPPPPPP/2RK4 d c g
+0 2rk4/pppppppp/8/8/8/8/PPPPPPPP/2RK4 d c h
+0 3r1k2/pppppppp/8/8/8/8/PPPPPPPP/3R1K2 f d g
+0 3r1k2/pppppppp/8/8/8/8/PPPPPPPP/3R1K2 f d h
+0 3r2k1/pppppppp/8/8/8/8/PPPPPPPP/3R2K1 g d h
+0 3rk3/pppppppp/8/8/8/8/PPPPPPPP/3RK3 e d f
+0 3rk3/pppppppp/8/8/8/8/PPPPPPPP/3RK3 e d g
+0 3rk3/pppppppp/8/8/8/8/PPPPPPPP/3RK3 e d h
+0 4r1k1/pppppppp/8/8/8/8/PPPPPPPP/4R1K1 g e h
+0 4rk2/pppppppp/8/8/8/8/PPPPPPPP/4RK2 f e g
+0 4rk2/pppppppp/8/8/8/8/PPPPPPPP/4RK2 f e h
+0 5rk1/pppppppp/8/8/8/8/PPPPPPPP/5RK1 g f h
+0 r1k5/pppppppp/8/8/8/8/PPPPPPPP/R1K5 c a d
+0 r1k5/pppppppp/8/8/8/8/PPPPPPPP/R1K5 c a e
+0 r1k5/pppppppp/8/8/8/8/PPPPPPPP/R1K5 c a f
+0 r1k5/pppppppp/8/8/8/8/PPPPPPPP/R1K5 c a g
+0 r1k5/pppppppp/8/8/8/8/PPPPPPPP/R1K5 c a h
+0 r2k4/pppppppp/8/8/8/8/PPPPPPPP/R2K4 d a e
+0 r2k4/pppppppp/8/8/8/8/PPPPPPPP/R2K4 d a f
+0 r2k4/pppppppp/8/8/8/8/PPPPPPPP/R2K4 d a g
+0 r2k4/pppppppp/8/8/8/8/PPPPPPPP/R2K4 d a h
+0 r3k3/pppppppp/8/8/8/8/PPPPPPPP/R3K3 e a f
+0 r3k3/pppppppp/8/8/8/8/PPPPPPPP/R3K3 e a g
+0 r3k3/pppppppp/8/8/8/8/PPPPPPPP/R3K3 e a h
+0 r4k2/pppppppp/8/8/8/8/PPPPPPPP/R4K2 f a g
+0 r4k2/pppppppp/8/8/8/8/PPPPPPPP/R4K2 f a h
+0 r5k1/pppppppp/8/8/8/8/PPPPPPPP/R5K1 g a h
+0 rk6/pppppppp/8/8/8/8/PPPPPPPP/RK6 b a c
+0 rk6/pppppppp/8/8/8/8/PPPPPPPP/RK6 b a d
+0 rk6/pppppppp/8/8/8/8/PPPPPPPP/RK6 b a e
+0 rk6/pppppppp/8/8/8/8/PPPPPPPP/RK6 b a f
+0 rk6/pppppppp/8/8/8/8/PPPPPPPP/RK6 b a g
+0 rk6/pppppppp/8/8/8/8/PPPPPPPP/RK6 b a h
+1 1k1r4/pppppppp/8/8/8/8/PPPPPPPP/1K1R4 b a d
+1 1k2r3/pppppppp/8/8/8/8/PPPPPPPP/1K2R3 b a e
+1 1k3r2/pppppppp/8/8/8/8/PPPPPPPP/1K3R2 b a f
+1 1k4r1/pppppppp/8/8/8/8/PPPPPPPP/1K4R1 b a g
+1 1k5r/pppppppp/8/8/8/8/PPPPPPPP/1K5R b a h
+1 1kr5/pppppppp/8/8/8/8/PPPPPPPP/1KR5 b a c
+1 2k1r3/pppppppp/8/8/8/8/PPPPPPPP/2K1R3 c a e
+1 2k1r3/pppppppp/8/8/8/8/PPPPPPPP/2K1R3 c b e
+1 2k2r2/pppppppp/8/8/8/8/PPPPPPPP/2K2R2 c a f
+1 2k2r2/pppppppp/8/8/8/8/PPPPPPPP/2K2R2 c b f
+1 2k3r1/pppppppp/8/8/8/8/PPPPPPPP/2K3R1 c a g
+1 2k3r1/pppppppp/8/8/8/8/PPPPPPPP/2K3R1 c b g
+1 2k4r/pppppppp/8/8/8/8/PPPPPPPP/2K4R c a h
+1 2k4r/pppppppp/8/8/8/8/PPPPPPPP/2K4R c b h
+1 2kr4/pppppppp/8/8/8/8/PPPPPPPP/2KR4 c a d
+1 2kr4/pppppppp/8/8/8/8/PPPPPPPP/2KR4 c b d
+1 3k1r2/pppppppp/8/8/8/8/PPPPPPPP/3K1R2 d a f
+1 3k1r2/pppppppp/8/8/8/8/PPPPPPPP/3K1R2 d b f
+1 3k1r2/pppppppp/8/8/8/8/PPPPPPPP/3K1R2 d c f
+1 3k2r1/pppppppp/8/8/8/8/PPPPPPPP/3K2R1 d a g
+1 3k2r1/pppppppp/8/8/8/8/PPPPPPPP/3K2R1 d b g
+1 3k2r1/pppppppp/8/8/8/8/PPPPPPPP/3K2R1 d c g
+1 3k3r/pppppppp/8/8/8/8/PPPPPPPP/3K3R d a h
+1 3k3r/pppppppp/8/8/8/8/PPPPPPPP/3K3R d b h
+1 3k3r/pppppppp/8/8/8/8/PPPPPPPP/3K3R d c h
+1 3kr3/pppppppp/8/8/8/8/PPPPPPPP/3KR3 d a e
+1 3kr3/pppppppp/8/8/8/8/PPPPPPPP/3KR3 d b e
+1 3kr3/pppppppp/8/8/8/8/PPPPPPPP/3KR3 d c e
+1 4k1r1/pppppppp/8/8/8/8/PPPPPPPP/4K1R1 e a g
+1 4k1r1/pppppppp/8/8/8/8/PPPPPPPP/4K1R1 e b g
+1 4k1r1/pppppppp/8/8/8/8/PPPPPPPP/4K1R1 e c g
+1 4k1r1/pppppppp/8/8/8/8/PPPPPPPP/4K1R1 e d g
+1 4k2r/pppppppp/8/8/8/8/PPPPPPPP/4K2R e a h
+1 4k2r/pppppppp/8/8/8/8/PPPPPPPP/4K2R e b h
+1 4k2r/pppppppp/8/8/8/8/PPPPPPPP/4K2R e c h
+1 4k2r/pppppppp/8/8/8/8/PPPPPPPP/4K2R e d h
+1 4kr2/pppppppp/8/8/8/8/PPPPPPPP/4KR2 e a f
+1 4kr2/pppppppp/8/8/8/8/PPPPPPPP/4KR2 e b f
+1 4kr2/pppppppp/8/8/8/8/PPPPPPPP/4KR2 e c f
+1 4kr2/pppppppp/8/8/8/8/PPPPPPPP/4KR2 e d f
+1 5k1r/pppppppp/8/8/8/8/PPPPPPPP/5K1R f a h
+1 5k1r/pppppppp/8/8/8/8/PPPPPPPP/5K1R f b h
+1 5k1r/pppppppp/8/8/8/8/PPPPPPPP/5K1R f c h
+1 5k1r/pppppppp/8/8/8/8/PPPPPPPP/5K1R f d h
+1 5k1r/pppppppp/8/8/8/8/PPPPPPPP/5K1R f e h
+1 5kr1/pppppppp/8/8/8/8/PPPPPPPP/5KR1 f a g
+1 5kr1/pppppppp/8/8/8/8/PPPPPPPP/5KR1 f b g
+1 5kr1/pppppppp/8/8/8/8/PPPPPPPP/5KR1 f c g
+1 5kr1/pppppppp/8/8/8/8/PPPPPPPP/5KR1 f d g
+1 5kr1/pppppppp/8/8/8/8/PPPPPPPP/5KR1 f e g
+1 6kr/pppppppp/8/8/8/8/PPPPPPPP/6KR g a h
+1 6kr/pppppppp/8/8/8/8/PPPPPPPP/6KR g b h
+1 6kr/pppppppp/8/8/8/8/PPPPPPPP/6KR g c h
+1 6kr/pppppppp/8/8/8/8/PPPPPPPP/6KR g d h
+1 6kr/pppppppp/8/8/8/8/PPPPPPPP/6KR g e h
+1 6kr/pppppppp/8/8/8/8/PPPPPPPP/6KR g f h
+!
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.