Crates.io | rust-warrior |
lib.rs | rust-warrior |
version | 0.14.0 |
source | src |
created_at | 2019-07-28 08:21:50.043704 |
updated_at | 2022-07-24 00:58:36.084702 |
description | Game for learning Rust, inspired by Ruby Warrior |
homepage | |
repository | https://github.com/miller-time/rust-warrior |
max_upload_size | |
id | 152286 |
size | 298,690 |
This game is inspired by Ruby Warrior, which I played many years ago.
This is a game designed to teach the Ruby language and artificial intelligence in a fun, interactive way.
You play as a warrior climbing a tall tower to reach the precious Ruby at the top level. On each floor you need to write a Ruby script to instruct the warrior to battle enemies, rescue captives, and reach the stairs. You have some idea of what each floor contains, but you never know for certain what will happen. You must give the Warrior enough artificial intelligence up-front to find his own way.
This project started as a direct port but because Rust is a compiled language and has its famous ownership and borrowing rules, I've designed Rust Warrior partly from scratch.
Rust Warrior ships with two major components: a binary that generates a new game directory, and a library which contains the main game engine.
To get started, install rust-warrior
.
$ cargo install rust-warrior
Then run rust-warrior
and follow the prompts to pick a player name and
set up all the necessary files in a new game directory.
Then navigate to rustwarrior/<name>
(the name you provided). You'll find
a README.md
with instructions for level 1 and a src/main.rs
with the
scaffolding for a Rust Warrior player project (with some rust_warrior
imports).
After reviewing the instructions, start playing level 1 by running the project:
$ cargo run
ncurses
To switch from the default println!()
renderer to ncurses, simply enable the
"ncurses" feature in your Cargo.toml
that was generated.
rust-warrior = { version = "0.14.0", features = ["ncurses"] }
This will produce a combat.log
file each time you play a level. You can use
this file to make tweaks in your Warrior code and improve the outcome of the
level.