#![feature(generic_const_exprs)]
#![allow(incomplete_features)] #![warn(missing_docs)]
pub mod gamemodes;
pub mod machine;
pub mod recipe;
pub mod research;
pub mod resources;
mod tick;
use std::sync::Once;
pub use crate::resources::{ResourceType, bundle, resource};
use crate::{
gamemodes::{GameMode, StartingResources},
tick::Tick,
};
static ONCE: Once = Once::new();
pub fn play<G: GameMode>(main: fn(Tick, G::StartingResources) -> (Tick, G::VictoryResources)) -> ! {
let mut call_once_ran = false;
ONCE.call_once(|| call_once_ran = true);
if !call_once_ran {
panic!(
"play() can only be called once per program execution to prevent cheating via multithreading."
);
}
let tick = Tick::start();
let start_resources = G::StartingResources::init(&tick);
let (tick, _points) = main(tick, start_resources);
println!("You won in {} ticks!", tick.cur());
std::process::exit(0);
}
pub trait Sealed {}
pub mod mod_reexports {
pub use crate::{
gamemodes::GameMode,
play,
recipe::{HandRecipe, Recipe},
research::{ResearchPoint, Technology},
resources::{Bundle, InsufficientResourceError, Resource, ResourceType},
tick::Tick,
};
}