pvn/README.md

21 lines
1.1 KiB
Markdown
Raw Normal View History

2017-02-18 23:34:41 -06:00
# Pirate vs Ninja Client Library
This is a client for [Pirate vs Ninja](http://www.majcher.com/pvn/) written in Rust. It can be used standalone or as a library.
## Usage
### Command Line
`cargo run <pirate_name> <ninja_name>`
#### Example
malacoda@kraken:~/Projects/pvn$ cargo run Pie "Windows 98"
Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
Running `target/debug/pvn Pie Windows\ 98`
Pirate { name: "Captain Pie", swashbuckling: 19, drunkenness: 9, booty: 15, weapons: ["Cannon", "Broken Bottle", "Belaying Pin"] } => 46
Ninja { name: "Ninja Master Windows 98", sneakiness: 9, pajamas: 15, pointy_things: 19, weapons: ["Poison Dart", "Thousand Blossom Finger", "Death Touch"] } => 46
It's a tie!
### Library
The library provides the `Pirates` and `Ninjas` types, which each keep a cache of `Pirate` and `Ninja` objects. Given a `Pirates` object, you can call `pirates.get(&str)` to obtain a reference to the `Pirate` with the given name. Or, you can create a `Pirate` or `Ninja` by passing in HTML to `Pirate::from_html(&str)`.
#### Example
See `src/main.rs`