Skip to content

Latest commit

 

History

History
104 lines (75 loc) · 4.02 KB

README.md

File metadata and controls

104 lines (75 loc) · 4.02 KB

Zebra.rs

Rust port of Zebra. A strong Othello program.

This repository also contains a source code for Webzebra, wasm version based on the Rust port, which runs in the browser.

This project is a result of transpiling original sources from C to Rust using c2rust and gradual refactoring of the output. The code is quite messy in many places and contains a lot of refactoring artifacts. The goal is to gradually get it in shape, but currently expect a lot of rough edges.

Future goals

  • Add more features to WebZebra (to be roughly on par with WZebra or Reversatile)
  • Getting rid of unsafe, global variables, cleaning up c2rust/refactoring artifacts
  • Separate the engine better from UI (CLI or Webzebra) and make it more usable and less prone to bugs
  • In further future, extend/optimize the engine (e.g. make it multithreaded, which should be easier to do in Rust than in the original C code)

Building

Following instructions are for CLI version of zebra and its tools. For building Webzebra, see README.md in webzebra directory.

Requirements

To build the project, you need nightly Rust. You can install it using rustup. See here for more information on how to get rustup.

# Install nightly toolchain
rustup toolchain install nightly
# Override the toolchain for the project directory
rustup override set nightly

Linux

On Linux (or WSL), you should now be able to build the whole project.

cargo build

Windows

Not all crates in this repository can be built on Windows. This is because some original crates depend on some linux specific APIs from libc. The goal is to eventually get rid of these dependencies and make all crates multiplatform. You can only build engine,flate2-coeff-source,webzebra/crate, script, tests and their dependencies. To do that, just go to the specific directory and run cargo build.

Running Tests

Main test suite is composed of a ~180 snapshot tests running against CLI apps. Run them with:

bash ./run-tests.sh

These tests will try to report coverage, which fails if you don't have LLVM/Cargo tools for that. You can install them with:

rustup component add llvm-tools-preview
cargo install cargo-binutils

Running the game (CLI)

To run the game in terminal, run:

cargo run --bin zebra

See available options in -help. Options are identical to the original zebra program. Source code for this binary is located in /legacy-zebra directory.

cargo run --bin zebra -- -help

Related projects

  • Zebra

    • Original program written in C by Gunnar Andersson between 1997-2005
    • Original version is just a CLI, so it's not as easy to use as UI versions below
    • Source code can be downloaded from the website.
  • WZebra

    • Windows version with UI. Probably the most popular version.
  • Reversatile

    • Android version - uses slightly adjusted original zebra code (CLI)
    • Continuation of Droidzebra, which was abandoned

Other Othello engines

  • Saio
    • Probably the most advanced actively developed engine at the moment
  • NText - updated version on GitHub
  • Edax

License

The project is licensed under GNU GENERAL PUBLIC LICENSE, version 2 (same as the original source, which this code is based on).

See LICENSE file for more details.