Crate rust_warrior
source · [−]Expand description
Rust Warrior
A textual turn-based AI game for learning Rust, based on Ruby Warrior.
You will progress through levels controlling the
Warrior
, by deciding which action
to take based on the surroundings. These decisions will be defined with
Rust code in the play_turn
method of Player
.
A Note About Rust vs Ruby
There are some notable differences between this game and Ruby
Warrior. Since Ruby is an interpreted language, Ruby Warrior is played
by interacting with a player.rb
script which controls the warrior.
The rubywarrior
command then leverages the Ruby interpreter to run
that script. In the Rust version, you will generate a Rust project which
includes rust-warrior
as a dependency in its Cargo.toml
file. The
Game
is then imported. To run it, you simply use
cargo run
like in any other Rust project.
Re-exports
pub use actions::Direction;
pub use floor::Tile;
pub use game::Game;
pub use player::Player;
pub use unit::UnitType;
pub use warrior::Warrior;
Modules
actions the player can instruct the Warrior to take
The game engine
contains types that represent the topology of a level
where it all starts
contains the trait exposed to the player for controlling the Warrior
contains the struct for saving player name and current level
contains some methods for generating the game files
contains some helper functions for prompting input from the player
contains types that represent units that appear in the game
contains the interface exposed to the player for controlling the Warrior