#include "sliding_tile_lib.h"
#include <istream>
+#include <ostream>
#include <stdexcept>
signed char adjacent[BOARD_SIZE][5] = {
return is;
}
+std::ostream& operator<<(std::ostream& os, const Board& board) {
+ for (int i = 0; i < BOARD_SIZE; i++) {
+ if (i > 0) {
+ os << " ";
+ }
+ os << int(board.board[i]);
+ }
+ return os;
+}
+
signed char Board::hole() const {
for (int i = 0; i < BOARD_SIZE; i++) {
if (board[i] == 0) {
#define _SLIDING_TILE_LIB_H
#include <istream>
+#include <ostream>
const int BOARD_DIM = 4;
const int BOARD_SIZE = BOARD_DIM * BOARD_DIM;
signed char hole() 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];