25 April 2025

Chess-Program-Requirements

by Carson Kempf

Game Assignment Set: Chess


Rules

Exception

Instead of the official three board state repetition draw rule:


For the last 8 moves:
    If (no capture OR no promotions OR no pawn movement) AND (moves {0,1,2,3} == {4,5,6,7}):
        A draw occurs

# {0,1,2,3} == {4,5,6,7}    if the starting position (rank and file) and ending position (rank and file) of the moves are identical

AI Framework

make_move()

Each call to make_move():

Note

  1. NEVER modify the member variables of the AI framework classes
  2. IMPLEMENT the state of the board & all data-structures

Input

Initial States and FEN Notation

  1. FEN starting position

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1

  1. And after the move 1.e4:

rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1

  1. And then after 1…c5:

rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2

  1. And then after 2.Nf3:

rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2

A FEN record contains six fields, each separated by a space. The fields are as follows:

  1. Piece placement data:
  1. Active color: “w” means that White is to move; “b” means that Black is to move.

  2. Castling availability:

  1. En passant target square:
  1. Halfmove clock:
  1. Fullmove number:


Output

Universal Chess Interface Notation

Examples:

e2e4

e7e5

e1g1 (white short castling)

e7e8q (for promotion)