Project

chess

0.04
No release in over a year
A fast chess library that use bitboards to play chess with Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Chess

build codecov

A fast Ruby gem to play chess with Ruby. This library is quite fast because manage game situations with bitboards. Also, the move generator is written in C as a Ruby extension.

Requirements

  • Ruby 2.5 or higher

Installation

gem install chess

Usage

require 'chess'

g = Chess::Game.new
until g.over?
  begin
    print "Give me a #{g.active_player} move: "
    input = gets.chop
    break if input == 'quit'
    g << input
    puts g
    puts g.moves.last
  rescue Chess::IllegalMoveError => e
    puts 'Illegal move!'
  end
end
puts g.status

Documentation is available here.

Questions or problems?

If you have any issues please add an issue on GitHub or fork the project and send a pull request.

Copyright

Copyright (c) 2021 Enrico Pilotto (@pioz). See LICENSE for details.