The core game logic that is at the center of all Play Suipi products.
- Install the Rust language. (rust-lang.org)
- Run the demo game.
cargo runBecause Suipi randomly shuffles the deck before each game, you cannot play the same game twice by default. You can get around this by specifying a seed to use when shuffling. If you use the same seed twice, you will get the exact same shuffle both times.
You can specify a seed for the game to use by passing an argument with the
path to a seed file. A seed file is just a plain text file with a number
from 0 to 255 on each line. There may be up to 32 lines in the file,
anything over that will be ignored, and anything less than that will be assumed
to be a zero. So a blank file would be a seed of 32 zeros.
touch ./seed.txt
cargo run ./seed.txtRust needs to install target plugins for each architecture we want to compile
for. We can do this using the rustup tool installed in the "Quick Start".
make initThe
make initcommand will install all of the Rust targets listed below.
Build Android Libraries:
make androidBuild iOS Libraries:
make iosBuild macOS Libraries:
make macosInstall Android targets:
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-androidEnable Rust nightly toolchain:
rustup toolchain install nightlyInstall iOS targets:
This allows us to compile Rust code for iOS devices.
rustup target add aarch64-apple-ios aarch64-apple-ios-sim x86_64-apple-iosInstall macOS targets:
This allows us to compile Rust code for macOS devices.
rustup target add aarch64-apple-darwin x86_64-apple-darwinInstall cbindgen command:
This tool lets us generate a C header file with bindings for our library.
cargo install cbindgenGenerate header file:
This C header file can be used to generate FFI bindings for different languages.
cbindgen --crate playsuipi_core -c cbindgen.toml > target/playsuipi_core.hRun the unit and integration tests.
cargo testOn Linux, you can run cargo commands inside of
GDB using the ./bin/debug.sh script.
./bin/debug.sh testThere is also a ./bin/record.py script that you can use to record your moves
as you go, and replay them if you need to restart.
python3 -m pip install --user pwntools
touch log.txt seed.txt
./bin/record.pyThe ./bin/record.py script will automatically save your moves to a log file,
which you can configure with the LOG_PATH argument. By default this is set to
./log.txt. The log file contains plain text Suipi annotations on each line.
echo '!1' >> log2.txt
echo '!1' >> log2.txt
./bin/record.py LOG_PATH=./log2.txtTo specify a seed file for your game, you can use the SEED_PATH argument.
By default this is set to ./seed.txt.
touch ./seed2.txt
./bin/record.py SEED_PATH=./seed2.txtThe ./bin/record.py script will automatically run GDB for you if you pass a
GDB argument.
Note: By default the script will attempt to run the GDB process in a new tmux pane. If you are not using tmux, you may configure this behaviour by setting the
context.terminalvariable at the top of the script.
./bin/record.py GDB