#1 Solution to Blitz6 ChessWin prediction

Thanks to organizers for this fun competition!

The key to solve all this puzzles was “Chess Configuration” puzzle, which asked to recognize FEN from images. I tried 2 approaches, but both had trouble with black pawns on dark background, so they gave .001 score, just below most competitors. Luckily, I got a teammate.

Chess Win Prediction
For this one I installed stockfish and called it from python API, as below. It disagreed with provided labels 7% of time, so probably labels were incorrect.

engine = chess.engine.SimpleEngine.popen_uci("stockfish")
limit = chess.engine.Limit(time=.2)

def predict_win(fen, turn):
    fen: fen string
    turn: 'b' or 'w'

    ext_fen = f'{fen} {turn} - - 0 1'
    board = chess.Board(ext_fen)
    result = engine.analyse(board, limit)

    score = result['score'].white() # from white perspective
    if score.is_mate():
        value = score.mate()
        value = score.score()
    winner = 'white' if value > 0 else 'black'
    return winner

Yes we used the same technique but got a slightly lower score, but I only saw this post after the competition ended where they say that it’s only human players and not an engine that generated winners. That explains why your approach had better score since you didn’t use a high depth, whereas we use a 20 depth lookahead :confused:

Congrats :wink:

Oh, that makes sense. I wasn’t aware humans still play this game.

1 Like

It would be more useful information if it was torn before the end of the competition. :wink: