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-11 07:26:32 +01:00
|
|
|
mod simulator;
|
|
|
|
mod strategies {
|
|
|
|
pub mod examples;
|
2016-03-13 10:05:05 +01:00
|
|
|
pub mod cheating;
|
2016-03-11 07:26:32 +01:00
|
|
|
}
|
2016-03-06 11:13:08 +01:00
|
|
|
mod info;
|
2016-03-06 01:54:46 +01:00
|
|
|
|
2016-03-07 06:44:17 +01:00
|
|
|
#[allow(unused_imports)]
|
|
|
|
use log::LogLevel::{Trace, Debug, Info, Warn, Error};
|
2016-03-06 10:35:19 +01:00
|
|
|
|
|
|
|
struct SimpleLogger;
|
|
|
|
impl log::Log for SimpleLogger {
|
|
|
|
fn enabled(&self, metadata: &log::LogMetadata) -> bool {
|
2016-03-07 06:44:17 +01:00
|
|
|
metadata.level() <= 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| {
|
2016-03-13 10:05:05 +01:00
|
|
|
//max_log_level.set(log::LogLevelFilter::Trace);
|
|
|
|
max_log_level.set(log::LogLevelFilter::Info);
|
2016-03-06 10:35:19 +01:00
|
|
|
Box::new(SimpleLogger)
|
2016-03-07 06:44:17 +01:00
|
|
|
}).unwrap();
|
2016-03-06 10:35:19 +01:00
|
|
|
|
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-13 10:05:05 +01:00
|
|
|
let n = 1000;
|
2016-03-11 07:26:32 +01:00
|
|
|
// simulator::simulate(&opts, &strategies::examples::AlwaysDiscard, n);
|
|
|
|
// simulator::simulate_symmetric(&opts, strategies::examples::AlwaysPlayConfig, n);
|
|
|
|
// simulator::simulate(
|
|
|
|
// &opts,
|
|
|
|
// &vec![
|
|
|
|
// Box::new(strategies::examples::AlwaysPlayConfig),
|
|
|
|
// Box::new(strategies::examples::AlwaysPlayConfig),
|
|
|
|
// Box::new(strategies::examples::AlwaysPlayConfig),
|
|
|
|
// Box::new(strategies::examples::AlwaysPlayConfig),
|
|
|
|
// ],
|
|
|
|
// n);
|
2016-03-13 10:05:05 +01:00
|
|
|
// simulator::simulate_symmetric(
|
|
|
|
// &opts,
|
|
|
|
// strategies::examples::RandomStrategyConfig {
|
|
|
|
// hint_probability: 0.4,
|
|
|
|
// play_probability: 0.2,
|
|
|
|
// },
|
|
|
|
// n
|
|
|
|
// );
|
2016-03-11 07:26:32 +01:00
|
|
|
simulator::simulate_symmetric(
|
|
|
|
&opts,
|
2016-03-13 10:05:05 +01:00
|
|
|
strategies::cheating::CheatingStrategyConfig::new(),
|
2016-03-11 07:26:32 +01:00
|
|
|
n
|
|
|
|
);
|
2016-03-06 01:54:46 +01:00
|
|
|
}
|