forked from nna774/2048-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
koyoneNext.hpp
28 lines (25 loc) · 874 Bytes
/
koyoneNext.hpp
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
#pragma once
#include "koyone.hpp"
class KoyoneNext {
public:
KoyoneNext(Board::Grid grid) : grid(grid) { }
Dir decideDir() const;
static Koyone::GridMap iterarion(Koyone::GridMap&& map, int ITERATION){
Koyone::GridMap npws[ITERATION];
npws[0] = map;
for(int i(0); i < ITERATION - 1; ++i){
npws[i+1].reserve(npws[i].size());
for(auto const& e: npws[i]){
for(auto const& e2: nextPossibleWorld(e.first))
npws[i+1].emplace_back(e2.first, e.second);
}
if(npws[i+1].empty()) return npws[i];
}
return npws[ITERATION - 1];
}
static Koyone::GridMap nextPossibleWorld(Board::Grid);
private:
Board::Grid grid;
static unsigned int const constexpr DANGER = 30000;
static Koyone::GridList nextPossibleWorldLeft(Board::Grid);
};