blob: 128b0b32a9091b855bf93c34b117600590903cef (
plain) (
blame)
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
|
//
// Created by thecharlesblake on 3/21/18.
//
#ifndef SOLVITAIRE_SOLVABILITY_H
#define SOLVITAIRE_SOLVABILITY_H
#include <vector>
#include <set>
#include <chrono>
#include <mutex>
#include "../game/sol_rules.h"
#include "../solver/solver.h"
#include "../input-output/input/command_line_helper.h"
class solvability_calc {
public:
explicit solvability_calc(const sol_rules&, uint64_t);
void calculate_solvability_percentage(uint64_t, int, uint, command_line_helper::streamliner_opt, const std::vector<int>&);
typedef std::pair<int, solver::result> seed_result;
private:
struct seed_results {
explicit seed_results(std::vector<int>);
void add_result(solver::result::type);
std::atomic<int> solvable;
std::atomic<int> unsolvable;
std::atomic<int> timed_out;
std::atomic<int> mem_limit;
};
// Printing methods
void print_header(long, command_line_helper::streamliner_opt) const;
static void print_general_info(const seed_results&);
static void print_seed_info(seed_result);
static void print_null_seed_info();
static void print_seeds_in_prog(std::set<int>&);
// Solving methods
static seed_result solve_seed(int, std::chrono::milliseconds, const sol_rules&, uint64_t, game_state::streamliner_options);
const sol_rules& rules;
const uint64_t cache_capacity;
};
#endif //SOLVITAIRE_SOLVABILITY_H
|