Skip to content

Instantly share code, notes, and snippets.

@chrisroos
Last active November 8, 2016 08:11
Show Gist options
  • Save chrisroos/e58e47d3ea7f3d6c935a5f93943c08dc to your computer and use it in GitHub Desktop.
Save chrisroos/e58e47d3ea7f3d6c935a5f93943c08dc to your computer and use it in GitHub Desktop.

Demo of interacting with stockfish.js engine - https://chrisroos.github.io/upgraded-waddle/?#.


Stockfish

Glossary

  • UCI - Universal Chess Interface
  • Opening Book - Set of initial moves in a game of chess
    • White - move first
    • Black - move second
  • Ply
    • In two-player sequential games, a ply refers to one turn taken by one of the players.

Board layout

8 |__|__|__|__|__|__|__|__|
7 |__|__|__|__|__|__|__|__|
6 |__|__|__|__|__|__|__|__|
5 |__|__|__|__|__|__|__|__|
4 |__|__|__|__|__|__|__|__|
3 |__|__|__|__|__|__|__|__|
2 |__|__|__|__|__|__|__|__|
1 |__|__|__|__|__|__|__|__|
   a  b  c  d  e  f  g  h

FEN

Example: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"

Note. This is the standard start position of the board

  • Field 1 - state of the board
    • row 1 - black - rook, knight, bishop, queen, king, bishop, knight, rook
    • row 2 - black - 8 pawns
    • row 3 - 8 empty squares
    • row 4 - 8 empty squares
    • row 5 - 8 empty squares
    • row 6 - 8 empty squares
    • row 7 - white - 8 pawns
    • row 8 - white - rook, knight, bishop, queen, king, bishop, knight, rook
  • Field 2 - next move by "w"hite or "b"lack
  • Field 3 - Castling ability
    • K - white can castle kingside
    • Q - white can castle queenside
    • k - black can castle kingside
    • q - black can castle queenside
  • Field 4 - En passant target square
    • "-" = no en passant target square
  • Field 5 - Halfmove clock
    • Number of halfmoves since the last capture or pawn advance
  • Field 6 - Fullmove number
    • The number of the full move. It starts at 1, and is incremented after Black's move

UCI

Setting position

  • Using FEN (Forsyth-Edwards Notation)
  • Using moves from start position
    • Example: "position startpos moves e2e4 e7e5"
      • White pawn ends up at e4
      • Black pawn ends up at e5
    • This appears to be using the Algebraic notation

Scoring


  • James
    • How to determine current state of play - hardware or image recognition
  • Chris
    • Stockfish (or similar) to understand current state of the game
  • Ben
    • Generative music
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment