2016-03-06 01:54:46 +01:00
|
|
|
extern crate rand;
|
2016-03-06 10:35:19 +01:00
|
|
|
#[macro_use]
|
|
|
|
extern crate log;
|
2016-03-06 01:54:46 +01:00
|
|
|
|
|
|
|
mod game;
|
2016-03-06 07:49:40 +01:00
|
|
|
mod strategies;
|
2016-03-06 11:13:08 +01:00
|
|
|
mod info;
|
2016-03-06 01:54:46 +01:00
|
|
|
|
2016-03-06 10:35:19 +01:00
|
|
|
|
|
|
|
struct SimpleLogger;
|
|
|
|
impl log::Log for SimpleLogger {
|
|
|
|
fn enabled(&self, metadata: &log::LogMetadata) -> bool {
|
2016-03-06 11:13:08 +01:00
|
|
|
// metadata.level() <= log::LogLevel::Warn
|
|
|
|
metadata.level() <= log::LogLevel::Info
|
|
|
|
// metadata.level() <= log::LogLevel::Debug
|
2016-03-06 10:35:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fn log(&self, record: &log::LogRecord) {
|
|
|
|
if self.enabled(record.metadata()) {
|
|
|
|
println!("{} - {}", record.level(), record.args());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-06 01:54:46 +01:00
|
|
|
fn main() {
|
2016-03-06 10:35:19 +01:00
|
|
|
log::set_logger(|max_log_level| {
|
|
|
|
max_log_level.set(log::LogLevelFilter::Info);
|
|
|
|
Box::new(SimpleLogger)
|
|
|
|
});
|
|
|
|
|
2016-03-06 07:49:40 +01:00
|
|
|
let opts = game::GameOptions {
|
2016-03-06 01:54:46 +01:00
|
|
|
num_players: 4,
|
|
|
|
hand_size: 4,
|
2016-03-06 07:49:40 +01:00
|
|
|
num_hints: 8,
|
|
|
|
num_lives: 3,
|
|
|
|
};
|
2016-03-06 10:35:19 +01:00
|
|
|
strategies::simulate(&opts, &strategies::AlwaysPlay, 100);
|
2016-03-06 01:54:46 +01:00
|
|
|
}
|