-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgen_test_flip_v2.cpp
43 lines (41 loc) · 1.12 KB
/
gen_test_flip_v2.cpp
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
#include <array>
#include <bitset>
#include <iostream>
#include <random>
#include <vector>
#include <iostream>
#include <random>
#include "reversi.hpp"
int main() {
constexpr size_t count = 100000;
std::random_device rd;
std::mt19937 mt(rd());
std::uniform_int_distribution<int> dis(1, 2);
for (size_t i = 0; i < count; ++i) {
std::bernoulli_distribution dis_e(i / double(count));
Board board;
std::vector<size_t> empties;
for (size_t j = 0; j < Length; ++j) {
for (size_t k = 0; k < Length; ++k) {
if (dis_e(mt)) {
board[j][k] = static_cast<Square>(dis(mt));
} else {
board[j][k] = Square::Empty;
empties.push_back(j * Length + k);
}
}
}
if (empties.empty()) {
--i;
continue;
}
std::uniform_int_distribution<size_t> dis_pos(0, std::size(empties) - 1);
size_t pos = empties.at(dis_pos(mt));
auto res = flip(board, pos);
std::cout << to_bit(board, Square::Player).to_ulong() << " "
<< to_bit(board, Square::Opponent).to_ulong() << " "
<< pos << " "
<< res.to_ulong() << "\n";
}
return 0;
}