Skip to content

Commit

Permalink
Merge pull request #37 from miguel-ambrona/ambrona@input-sanity-check
Browse files Browse the repository at this point in the history
Add sanity check on input positions - Fixes #36
  • Loading branch information
miguel-ambrona authored Jan 16, 2024
2 parents a038f89 + b8197d9 commit 0f5847e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/deadpos.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,12 @@ def main():
words = line.split(">>=")
fen = words[0].strip()

fen_board = fen.split(" ")[0]
if not chess.Board(fen_board + " w - - 0 1").is_valid() and \
not chess.Board(fen_board + " b - - 0 1").is_valid():
print("Invalid FEN")
continue

nb_tokens = len(fen.split(" "))
if nb_tokens < 6:
fen += " ?" * (5 - nb_tokens) + " 1"
Expand Down

0 comments on commit 0f5847e

Please sign in to comment.