Reject out-of-range endgame FENs at entry (#25)

Add FEN.piece_count/1 and reject positions with more than 7 pieces in the Endgame changeset, so an 8+ piece FEN fails at entry instead of saving and then blocking at play.

Accumulate all FEN issues rather than letting a later check overwrite an earlier one, and guard the seed FENs with a test (dropping the out-of-range seed that bypassed the changeset).
This commit is contained in:
2026-11-03 12:18:22 +01:00
parent dd060531d3
commit ff7adcf308
6 changed files with 128 additions and 10 deletions
-5
View File
@@ -8,11 +8,6 @@ defmodule Chesstrainer.Repo.Seeds.Endgames do
notes: "Basic rook endgame",
result: :win
},
%{
fen: "3k4/2n2B2/1KP5/2B2p2/5b1p/7P/8/8 b - - 0 0",
color: :black,
result: :win
},
%{
fen: "r7/4R2P/3p4/3k1K2/2p5/8/8/8 b - - 0 0",
color: :black,