28 lines
676 B
Rust
28 lines
676 B
Rust
//! Prints the reference state hash for the cross-target determinism probe.
|
|
//! Usage: `cargo run -p sim --example selftest -- [seed]`
|
|
|
|
use std::env;
|
|
|
|
use sim::fixed::from_int;
|
|
use sim::state::{Command, Sim};
|
|
|
|
fn main() {
|
|
let seed: u64 = env::args()
|
|
.nth(1)
|
|
.and_then(|a| a.parse().ok())
|
|
.unwrap_or(42);
|
|
|
|
let mut sim = Sim::default_match(seed);
|
|
sim.submit(Command::Fire {
|
|
angle_mdeg: 45_000,
|
|
power: from_int(1),
|
|
weapon: 1,
|
|
})
|
|
.expect("scripted command must be valid");
|
|
for _ in 0..300 {
|
|
sim.tick();
|
|
}
|
|
|
|
println!("seed={seed} sim_version={} hash={}", sim::SIM_VERSION, sim.state_hash());
|
|
}
|