Code Monkey home page Code Monkey logo

walleye's Introduction

Walleye

tests

Walleye is a UCI-compatible chess engine written using the classic alpha-beta style AI.

Play Against It

Challenge me on Lichess! https://lichess.org/@/Walleye_Bot

The engine should also work in any chess program that supports UCI, at this time however it has only been tested with Cute Chess.

Example Usage

By default, the engine launches in UCI mode and expects to be loaded into a chess GUI.
However, you can run some commands from the terminal, such as -P to watch the engine play against itself or -T to benchmark move generation and evaluation.

# helpful when profiling, will accept a FEN string
./walleye -T --depth=5
# start a game from a FEN string and have the engine play against itself
./walleye --fen="r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1" -P

demo

Use ./walleye --help for a complete list of commands.

Building

It is strongly recommended you compile the engine with --release for the best performance.

cargo build --release

Portability

In the cargo/config file the target CPU is set to native. During testing I saw modest performance improvements using this setting. If however you plan to compile Walleye and use the binary on multiple systems you should delete these lines before compiling.

About

Board

  • Square Centric 12x12 Array

Extra board squares are sentinel squares to make boundary checking easier.

Search

  • Alpha-Beta Pruning
  • Iterative Deepening
  • Capture/Check Extension
  • Killer Moves
  • MVV-LVA
  • PV Search

Evaluation

  • Piece Square Table

Other

  • Terminal based games with unicode chess boards
  • Robust logging

Tests

Walleye comes with a suite of unit tests and perft tests. It has been verified on a variety of positions to around depth 5.

# run perft tests
cargo test perft
# run all tests
cargo test

Rating

Walleye was ranked by CCRL, you can find its rating between versions here

Resources

Some resources and tools I found helpful when creating this engine.

Issues

If you find an issue with the engine please include the walleye_{PID}.log file along with the report, you can enable this by setting DebugLogLevel to Info in the UCI options.

License

Walleye is under the MIT license.

walleye's People

Contributors

djmitche avatar mitchelpaulin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

walleye's Issues

can not compile v1.4.0 on Linux

here is the terminal log :

$ cargo build --release --verbose
       Fresh cfg-if v1.0.0
       Fresh lazy_static v1.4.0
       Fresh unicode-width v0.1.9
       Fresh bitflags v1.3.2
       Fresh vec_map v0.8.2
       Fresh ansi_term v0.11.0
       Fresh strsim v0.8.0
       Fresh textwrap v0.11.0
       Fresh libc v0.2.103
       Fresh log v0.4.14
       Fresh atty v0.2.14
       Fresh thread-id v3.3.0
       Fresh colored v2.0.0
       Fresh clap v2.33.3
       Fresh simple-logging v2.0.2
   Compiling walleye v1.4.0 (/home/tissatussa/Compiled/Walleye_v1.4.0)
     Running `rustc --crate-name walleye --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C lto -C codegen-units=1 -C metadata=c0314d45e350ab32 -C extra-filename=-c0314d45e350ab32 --out-dir /home/tissatussa/Compiled/Walleye_v1.4.0/target/release/deps -L dependency=/home/tissatussa/Compiled/Walleye_v1.4.0/target/release/deps --extern clap=/home/tissatussa/Compiled/Walleye_v1.4.0/target/release/deps/libclap-92b2ce1d83fefcb6.rlib --extern colored=/home/tissatussa/Compiled/Walleye_v1.4.0/target/release/deps/libcolored-af5d305c32b4ddbc.rlib --extern log=/home/tissatussa/Compiled/Walleye_v1.4.0/target/release/deps/liblog-f28a7c1eb8fddef7.rlib --extern simple_logging=/home/tissatussa/Compiled/Walleye_v1.4.0/target/release/deps/libsimple_logging-d9170c4c5c5a3ed5.rlib`
error[E0277]: `[Option<(board::Point, board::Point)>; 100]` is not an iterator
   --> src/engine.rs:214:16
    |
214 |     for mov in search_info.pv_moves {
    |                ^^^^^^^^^^^^^^^^^^^^ borrow the array with `&` or call `.iter()` on it to iterate over it
    |
    = help: the trait `Iterator` is not implemented for `[Option<(board::Point, board::Point)>; 100]`
    = note: arrays are not iterators, but slices like the following are: `&[1, 2, 3]`
    = note: required because of the requirements on the impl of `IntoIterator` for `[Option<(board::Point, board::Point)>; 100]`
    = note: required by `into_iter`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: could not compile `walleye`

Caused by:
  process didn't exit successfully: `rustc --crate-name walleye --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -C lto -C codegen-units=1 -C metadata=c0314d45e350ab32 -C extra-filename=-c0314d45e350ab32 --out-dir /home/tissatussa/Compiled/Walleye_v1.4.0/target/release/deps -L dependency=/home/tissatussa/Compiled/Walleye_v1.4.0/target/release/deps --extern clap=/home/tissatussa/Compiled/Walleye_v1.4.0/target/release/deps/libclap-92b2ce1d83fefcb6.rlib --extern colored=/home/tissatussa/Compiled/Walleye_v1.4.0/target/release/deps/libcolored-af5d305c32b4ddbc.rlib --extern log=/home/tissatussa/Compiled/Walleye_v1.4.0/target/release/deps/liblog-f28a7c1eb8fddef7.rlib --extern simple_logging=/home/tissatussa/Compiled/Walleye_v1.4.0/target/release/deps/libsimple_logging-d9170c4c5c5a3ed5.rlib` (exit code: 1)

# of threads

Hi,

version 1.4 seems to use two threads, is it correct?

Thanx,
Alex

Bug when trying to checkmate

For the following input command:
./walleye -P -f '7k/4Q3/6K1/8/8/8/8/8 w - - 0 1'
It first does a search to depth 99, which is unneeded since it is clearly a mate in 1, and then prints the same board over and over instead of terminating program execution.

Drawing by 3-fold repitition in winning positions

Right now the engine does not know about the draw by 3-fold repetition rule (or any rules about draws for that matter). This means the engine will happily repeat moves even if its in a winning position.

Update the engine so, if the engine is in a winning position, it will not repeat moves.

[Question] What terminal do you use to produce

Hey! I've started implementing a chess engine in Rust and I was looking at the others for debugging/interface infrastructure, so I found yours! I really liked how you print the board using colored: this looks really cool and I wanted to implement something similar to have easier time looking at the positions in the engine (right now I have basic ASCII printing a-la python-chess/shakmaty). My question is: what terminal/fonts do you use? Any advice to make the output look like the one on your demo? This is what I currently get from running Walleye in my terminal:

Screenshot 2021-12-30 at 10 50 35

Walleye not running

Heya! 😄

I compile the app and ran it, but it gave no outputs (I think it should output some info and an readyok when you run it.

I then passed through a isready command, and the application exited.

It doesn't seem to comply with the UCI Protocol? Or is not functioning? Or I'm doing something wrong?

Here's what I ran:

image

50 move rule does not seem to be implemented

For the following command:
4k3/8/8/8/8/8/8/4K2R w - - 99 1
The engine should only play 1 move and then draw in accordance to the 50 move rule, but it keeps playing anyway. I've checked the code and it doesn't seem to have this rule implemented anywhere.

Problems with running the engine

For me it does not move at all under Arena. Under Cute Chess it does move but exceeds time soon. Both with traditional and Fischer clock.

Here is a debug from Arena:

2021-09-11 10:38:33,932-->1:quit
2021-09-11 10:38:34,3231-------------------Starting engine 1 Walleye 1.1.0 64-bit-------------------
2021-09-11 10:38:34,3231Configured Engine 1 Type: UCI
2021-09-11 10:38:34,3231Engine 1 dir: E:\Sakk\UCI-engines\Walleye
2021-09-11 10:38:34,3231Engine 1 commandline: E:\Sakk\UCI-engines\Walleye\Walleye_1.1.0-x64.exe
2021-09-11 10:38:34,4321Child Process Prio Adj: PID 1216 conhost.exe
2021-09-11 10:38:34,4321Engine 1 ProcessID: 7064
2021-09-11 10:38:34,4321Engine 1 Prio:32 ThreadPrio:0
2021-09-11 10:38:34,463-->1:uci
2021-09-11 10:38:34,463<--1:id name Walleye
2021-09-11 10:38:34,463<--1:id author Mitchel Paulin
2021-09-11 10:38:34,463<--1:uciok
2021-09-11 10:38:34,4631Child Process Prio Adj: PID 1216 conhost.exe
2021-09-11 10:38:34,463-->1:isready
2021-09-11 10:38:34,526<--1:readyok
2021-09-11 10:38:38,729**----------New game---2021-09-11 10:38:38,729 Szo -------------
2021-09-11 10:38:38,729**Loading book: E:\Sakk\Arena2\Books\IM_4mvs.abk
2021-09-11 10:38:44,9621Start calc, move no: 1
2021-09-11 10:38:44,9621Main Book Move IM_4mvs.abk: c7c5
2021-09-11 10:38:45,9471Start calc, move no: 3
2021-09-11 10:38:45,947-->1:ucinewgame
2021-09-11 10:38:45,947-->1:isready
2021-09-11 10:38:50,056-->1:position startpos moves e2e4 c7c5 e4e5
2021-09-11 10:38:50,056-->1:go wtime 121484 btime 121000 winc 1000 binc 1000

At this point I checked with Process Explorer and the engine was not even in memory.

Ideas

Hi Mitchel,

Nice job on the engine!

Just starting to get familiar with the code. New to rust so it will take some time. So far it looks great!

No specific issue. Is thier anything you need help on?

On my initial review it does not appear that you support using any sort of opening book moves. I'm looking at another another github project that could act as a source to provide a set of opening book moves. See https://github.com/niklasf/chess-openings

I have cloned and built Walleye.

Cute chess does not seem to install as documented. But that issues will go to them.

A few other ideas:

  • break out the fen functions from board
  • record moves
  • add AI to the engine

Losing most games on time

Hi Mitchel,

Author of Rustic here :) ( https://github.com/mvanthoor/rustic )

Your engine was mentioned on Talkchess.com, so I tried running a test against Rustic, version Alpha 1.1 (CCRL Blitz 1675). An often used time control for testing is 10s + 0.1s (so you can test 1000's of games without waiting a week). With this time control, WallEye 1.2.0 loses most games on time, often taking at least 5-6 seconds for the first move out of the opening book.

Because the time controls don't yet work correctly, the engine is essentially un-testable.

I hope you can spend some time fixing the time controls; I look forward to have another Rust engine in my testing pool.

Kind regards,
Marcel

no output in CuteChess (but plays ok)

while Walleye is calculating i see no pv line output in the CuteChess panel .. i have no troubles using Walleye on Linux, but it seems Walleye is simple ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.