Skip to content

aromatt/pushfour-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pushfour-rust Build Status

A pushfour bot in Rust. Uses Minimax with alpha-beta pruning.

What's Pushfour?

Connect Four, except pieces can be inserted from any edge. Boards are initialized with random obstructions to make things interesting.

Dependencies

This project currently depends on Nightly Rust. If you're ok with executing arbitrary code from the internet, just run:

$ curl -s https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly

Run tests

$ cargo test && ./run-scenarios

Play against the bot

Do either of the following (you'll be player 'b'; enter colon-separated row:col coordinates on your turn):

$ cargo run

Or:

$ cargo build --release
$ ./target/release/play-pushfour

Run scenarios

There are game scenarios for debugging the bot's logic in tests/scenarios/. To run them:

# Build the tool
$ cargo build --release

# Run scenarios
$ ./target/release/run-scenario tests/scenarios/some_scenario.txt [...]

Each scenario has its test-case-specific Minimax depth embedded in its filename as depth_N.

You can specify a scenario file that does not conform to this naming convention by adding -d DEPTH to the invocation:

$ ./target/release/run-scenario -d 5 some_scenario.txt

The -d option can also be used to run one of the scenarios in tests/scenarios/ with a different depth than its filename dictates:

# Run scenario foo_depth_8.txt with Minimax depth 5 instead of depth 8
$ ./target/release/run-scenario -d 5 <(cat tests/scenarios/foo_depth_8.txt)

About

Minimax Pushfour bot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published