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.

The Game Engine

The game engine uses the specs (Specs Parallel ECS) crate, which is an ECS library. This might be a familiar tool for game developers. It will hopefully increase the quality of the game’s implementation (and possibly allow for an easier transition to an Amethyst version at some point).


pub use actions::Direction;
pub use floor::Tile;
pub use game::Game;
pub use player::Player;
pub use unit::UnitType;
pub use warrior::Warrior;


actions the player can instruct the Warrior to take

ECS-based 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