]>
git.scottworley.com Git - slidingtile/blob - sliding_tile_lib.h
1b56da4c80a7e4fbc18947abc4a6f193c0eb057c
1 #ifndef _SLIDING_TILE_LIB_H
2 #define _SLIDING_TILE_LIB_H
9 const int BOARD_DIM
= 4;
10 const int BOARD_SIZE
= BOARD_DIM
* BOARD_DIM
;
12 struct InvertedBoard
{
13 signed char pos
[BOARD_SIZE
];
17 signed char board
[BOARD_SIZE
];
18 bool is_valid() const;
19 signed char hole() const;
20 InvertedBoard
invert() const;
21 int distance(const Board
& o
) const;
22 int distance(const InvertedBoard
& invo
) const;
23 bool operator==(const Board
& o
) const;
24 bool operator!=(const Board
& o
) const;
25 bool operator<(const Board
& o
) const;
27 std::istream
& operator>>(std::istream
& is
, Board
& board
);
28 std::ostream
& operator<<(std::ostream
& os
, const Board
& board
);
32 std::shared_ptr
<Step
> prev
;
33 std::vector
<Step
*> successors(std::shared_ptr
<Step
> shared_this
) const;
34 static signed char adjacent
[BOARD_SIZE
][5];
36 std::ostream
& operator<<(std::ostream
& os
, const Step
& step
);
39 #endif /* _SLIDING_TILE_LIB_H */