-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.rs
More file actions
70 lines (63 loc) · 1.66 KB
/
main.rs
File metadata and controls
70 lines (63 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#![windows_subsystem = "windows"]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(unused_imports)]
#[macro_use]
extern crate log;
mod csp_constraints;
mod packed;
mod csp_valid;
mod math;
mod level_constraints;
mod possible_boards;
mod search;
mod gui;
mod parsing;
mod benchmark;
mod constraints;
mod validate_symbol_probs;
use crate::gui::gui;
use std::fs::File;
use std::io::{self, BufRead};
use std::path::Path;
use crate::search::compute_win_chance_exact;
use std::time::Instant;
use std::io::{BufWriter, Write};
use std::collections::HashMap;
use crate::packed::{array_to_u64, u64_to_array, set_in_packed_state};
use crate::math::print_board;
use crate::level_constraints::get_constraint;
use crate::csp_valid::{count_valid_dumb, count_valid_smart};
use rayon::prelude::*;
use crate::csp_constraints::find_possible_boards;
use crate::possible_boards::accumulate_symbol_weights;
use crate::Mode::{BenchmarkNoGUI, GUI, ValidateNoGUI};
use crate::benchmark::benchmark;
use env_logger::{fmt::Color, Env, Builder};
use crate::validate_symbol_probs::validate;
enum Mode
{
GUI,
BenchmarkNoGUI,
ValidateNoGUI,
}
fn main() {
// change "info" to "warn" to hide thread-GUI communication
Builder::from_env(Env::default().default_filter_or("info"))
.format(|buf, record| {
writeln!(
buf,
"{}",
record.args()
)
})
.init();
// DON'T FORGET TO REMOVE #![windows_subsystem = "windows"] at the top of main.rs
// or there won't be a console
match GUI
{
GUI => gui(),
BenchmarkNoGUI => benchmark(),
ValidateNoGUI => validate(),
};
}