Project

stockfish

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby client for the Stockfish chess engine
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 5.0
~> 0.10
~> 10.0
 Project Readme

Ruby Stockfish

A ruby client for the Stockfish chess engine

Installation

$ gem install stockfish

Or add it to your application's Gemfile and install via bundler

gem 'stockfish'

Analyzing positions

Load a position in FEN notation that you want to analyze

fen = "3qr3/1b1rb2Q/p2pk1p1/1p1np3/4P3/P2BB3/1PP3PP/4R2K w - - 2 24"

Set the search depth (in number of half-moves) you want to use

Stockfish.analyze fen, { :depth => 12 }

Look at multiple variations by setting a multipv option

Stockfish.analyze fen, { :depth => 12, :multipv => 3 }

Communicating with the engine

You can also send UCI commands to Stockfish directly

engine = Stockfish::Engine.new
engine.execute "position fen q3r3/3r4/p2p2p1/1p2p1b1/8/P6k/1PP1Q2P/4BRK1 b - - 8 36"
engine.execute "setoption name MultiPV value 3"
engine.execute "go depth 10"

Requirements

Stockfish 6+ must be installed and available in your $PATH

$ which stockfish

Or you can load a Stockfish binary directly

engine = Stockfish::Engine.new("/usr/local/bin/stockfish")
engine.multipv(3)
engine.analyze fen, { :depth => 12 }