Skip to content

dngo/uci-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UCI Ruby

A ruby client for the uci chess engines, tested with stockfish Stockfish chess engine UCI documentation http://wbec-ridderkerk.nl/html/UCIProtocol.html

Installation

$ gem install uci-ruby

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

gem 'uci-ruby'

Analyzing positions

Load a position in FEN notation that you want to analyze

Basic usage

fen = "3qr3/1b1rb2Q/p2pk1p1/1p1np3/4P3/P2BB3/1PP3PP/4R2K w - - 2 24"
engine = Uci::Engine.new('bin/stockfish_8_x64_linux') #path to your binary 
engine.analyze fen

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

engine.analyze fen, { :depth => 5 }

Look at multiple variations by setting a multipv option

engine.multipv(3)
engine.analyze fen

Set engine level 1-20, 20 is the strongest

engine.level(2)
engine.analyze fen

set think time in milliseconds, the engine will be forced to move when time runs out

engine.analyze fen, { :movetime => 3000 }

Communicating with the engine

You can also send UCI commands to Uci directly

engine = Uci::Engine.new('bin/stockfish_8_x64_linux')
engine.write_to_engine "position fen q3r3/3r4/p2p2p1/1p2p1b1/8/P6k/1PP1Q2P/4BRK1 b - - 8 36"
engine.write_to_engine "setoption name MultiPV value 3"
engine.write_to_engine "go depth 10"

Requirements

Requires a chess engine which implements UCI such as Stockfish, Komodo, Rybka, Shredder we have included stockfish binary at bin/stockfish_8_x64_linux Or you can load your own binary

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages