]> git.scottworley.com Git - slidingtile/blob - sliding_tile_lib.h
c5d0a8bc66c99b7480d06a1c2b96811de9bbe6b6
[slidingtile] / sliding_tile_lib.h
1 #ifndef _SLIDING_TILE_LIB_H
2 #define _SLIDING_TILE_LIB_H
3
4 #include <istream>
5 #include <ostream>
6
7 const int BOARD_DIM = 4;
8 const int BOARD_SIZE = BOARD_DIM * BOARD_DIM;
9
10 struct InvertedBoard {
11 signed char pos[BOARD_SIZE];
12 };
13
14 struct Board {
15 signed char board[BOARD_SIZE];
16 bool is_valid() const;
17 signed char hole() const;
18 InvertedBoard invert() const;
19 int distance(const Board& o) const;
20 int distance(const InvertedBoard& invo) const;
21 };
22 std::istream& operator>>(std::istream& is, Board& board);
23 std::ostream& operator<<(std::ostream& os, const Board& board);
24
25 extern signed char adjacent[BOARD_SIZE][5];
26
27 #endif /* _SLIDING_TILE_LIB_H */