Skip to content
/ core Public

The core game logic that is at the center of all Play Suipi products

License

Notifications You must be signed in to change notification settings

playsuipi/core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Play Suipi Core

Rust

The core game logic that is at the center of all Play Suipi products.

Quick Start

  1. Install the Rust language. (rust-lang.org)
  2. Run the demo game.
cargo run

Because 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.txt

Testing

Run the unit and integration tests.

cargo test

Debugging

On Linux, you can run cargo commands inside of GDB using the ./bin/debug.sh script.

./bin/debug.sh test

Reproducing Issues

There 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.py

The ./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.txt

To 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.txt

The ./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.terminal variable at the top of the script.

./bin/record.py GDB