-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pentominoes.cpp
50 lines (38 loc) · 1.41 KB
/
Pentominoes.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
43
44
45
46
47
48
49
50
#include "Pentominoes.hpp"
using namespace std;
void Pentominoes::init()
{
static vector<Piece> pieces = {
{"F", {{0,1}, {0,2}, {1,0}, {1,1}, {2,1}}},
{"I", {{0,0}, {1,0}, {2,0}, {3,0}, {4,0}}},
{"L", {{0,0}, {1,0}, {2,0}, {3,0}, {3,1}}},
{"N", {{0,0}, {0,1}, {1,1}, {1,2}, {1,3}}},
{"P", {{0,0}, {0,1}, {1,0}, {1,1}, {2,0}}},
{"T", {{0,0}, {0,1}, {0,2}, {1,1}, {2,1}}},
{"U", {{0,0}, {1,0}, {1,1}, {1,2}, {0,2}}},
{"V", {{0,0}, {1,0}, {2,0}, {2,1}, {2,2}}},
{"W", {{0,0}, {1,0}, {1,1}, {2,1}, {2,2}}},
{"X", {{0,1}, {1,0}, {1,1}, {1,2}, {2,1}}},
{"Y", {{0,2}, {1,0}, {1,1}, {1,2}, {1,3}}},
{"Z", {{0,0}, {0,1}, {1,1}, {2,1}, {2,2}}}
};
set<Cell> board;
Ortho2d::rectBoard(board, rows, columns);
Ortho2d::init(board, pieces);
}
bool Pentominoes6x10::placementFilter(Piece const& aspect, Cell const& pos)
{
return (aspect.name == "X" && ((pos.rOffset > 1) || (pos.cOffset > 3)));
}
bool Pentominoes5x12::aspectFilter(Piece const& piece, int flip, int rot)
{
return ((piece.name == "F") && ((flip == 1) || (rot > 1)));
}
bool Pentominoes4x15::aspectFilter(Piece const& piece, int flip, int rot)
{
return ((piece.name == "F") && ((flip == 1) || (rot > 1)));
}
bool Pentominoes3x20::aspectFilter(Piece const& piece, int flip, int rot)
{
return ((piece.name == "F") && ((flip == 1) || (rot > 1)));
}