Skip to content

amarriner/ChessBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twitter Chess Bot

A bot that allows two Twitter accounts to play chess against one another.

This is a single node.js script that interfaces with a UCI chess engine(s) to process turns in a game. There are two twitter accounts: @ChessBotWhite and @ChessBotBlack. On an interval the script will execute an engine, load the current board position into it and process a move. If it finds a valid move it updates the state in two flat files (one in PGN and the other as a sequence of FEN positions) as well as building a PNG image of the current board. It then tweets the board image and the last move the the opposing Twitter account depending on whose turn it is.

The bot supports separate engines for the two accounts. Currently White is running Fruit and Black is running Glaurung.

Piece images from here.

Dependencies

  • Node module chess.js for various chess related functionality
  • Node module nexpect for interfacing with the UCI engine
  • Node module node-gd for building the board PNG image
  • Node module request to tweet
  • This small twitter module because the Node modules I found didn't allow updating with media

TODO

  • Recognize end of game and automatically start a new one
  • Integrate opening books into the engines
  • Investigate using stronger move lookups
  • Replace hard-coded hashtag interval
  • Remove old FEN processing and rely solely on the chess.js object

Sample Tweet

@ChessBotWhite 2. ... Nc6 #Chess pic.twitter.com/lfvqcyuXEm

— Chess Bot Black (@ChessBotBlack) February 21, 2014
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

Sample Board

Sample Board

About

Bot that pits two Twitter accounts against each other

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published