]> git.scottworley.com Git - slidingtile/blobdiff - sliding_tile_lib.h
Done with this tool
[slidingtile] / sliding_tile_lib.h
index 7e6004b4aad5b0a6b77140d5c957e986a1afb04b..c5d0a8bc66c99b7480d06a1c2b96811de9bbe6b6 100644 (file)
@@ -1,8 +1,27 @@
 #ifndef _SLIDING_TILE_LIB_H
 #define _SLIDING_TILE_LIB_H
 
 #ifndef _SLIDING_TILE_LIB_H
 #define _SLIDING_TILE_LIB_H
 
+#include <istream>
+#include <ostream>
+
 const int BOARD_DIM = 4;
 const int BOARD_SIZE = BOARD_DIM * BOARD_DIM;
 const int BOARD_DIM = 4;
 const int BOARD_SIZE = BOARD_DIM * BOARD_DIM;
+
+struct InvertedBoard {
+  signed char pos[BOARD_SIZE];
+};
+
+struct Board {
+  signed char board[BOARD_SIZE];
+  bool is_valid() const;
+  signed char hole() const;
+  InvertedBoard invert() const;
+  int distance(const Board& o) const;
+  int distance(const InvertedBoard& invo) const;
+};
+std::istream& operator>>(std::istream& is, Board& board);
+std::ostream& operator<<(std::ostream& os, const Board& board);
+
 extern signed char adjacent[BOARD_SIZE][5];
 
 #endif /* _SLIDING_TILE_LIB_H */
 extern signed char adjacent[BOARD_SIZE][5];
 
 #endif /* _SLIDING_TILE_LIB_H */