My solution for: https://noopschallenge.com/challenges/hexbot
Install rust
The canonical way to install rust is to use rustup:
curl https://sh.rustup.rs -sSf | sh
You need this on distros who do not have a supported rustc version in their packet sources. e.g. Debian Stable, Mint, openSUSE Leap, Ubuntu, ...
On distros which have the current rustc version in their packet sources, it can be used.
Distro | command |
---|---|
Arch Linux | sudo pacman -S rust |
Debian Testing/Unstable | sudo apt install cargo |
Fedora | sudo dnf install cargo |
openSUSE Tumbleweed | sudo zypper install cargo |
git clone https://github.com/rusty-snake/hexbot.git
cd hexbot
$ cargo run --release
Updating crates.io index
...
Compiling hexbot v0.0.11 (/home/rusty-snake/hexbot)
Finished release [optimized] target(s) in 4m 2s
Running `target/release/hexbot`
===== Hexbot =====
Should the count parameter be added? [yes|no] yes
What value should count have? [1-1000] 5
Should the width and height parameters be added? [yes|no] yes
What value should width have? [10-100,000] 500
What value should height have? [10-100,000] 500
[#E46AF7-(370|226), #FAFD72-(334|70), #6C1882-(440|490), #ECC44A-(451|181), #F528DF-(151|72)]
$ cargo build --release
$ cargo doc --no-deps --open
Using the hexbot library in your own project.
Cargo.toml
:
[dependencies]
hexbot = { git = "https://github.com/rusty-snake/hexbot", tag = "v0.0.12" }
futures = "0.3"
src/main.rs
:
use hexbot::{Count, Hexbot, Seed, WidthHeight};
use futures::executor::block_on;
fn main() {
let hb = block_on(Hexbot::fetch(
Count::no(),
WidthHeight::no(),
&Seed::no()
)).expect("Fetching failed");
println!("Hello from Hexbot: {}", hb);
}
For the next steps, see the documentation.
## [0.0.12] - 2020-02-01
### Removed
* `WithCoordinates` and `CoordinatesLimit`
### Changed
* make `Hexbot::fetch` async
* min rustc: 1.39.0
[0.0.12]: https://github.com/rusty-snake/hexbot/tree/v0.0.12
For the full Changelog see CHANGELOG.md.