#include "sliding_tile_lib.h"
+#include <istream>
+
signed char adjacent[BOARD_SIZE][5] = {
1, 4, -1, -1, -1,
0, 2, 5, -1, -1,
10, 13, 15, -1, -1,
11, 14, -1, -1, -1,
};
+
+std::istream& operator>>(std::istream& is, Board& board) {
+ for (int i = 0; i < BOARD_SIZE; i++) {
+ if (!is.good()) {
+ is.setstate(std::istream::failbit);
+ break;
+ }
+ if (i > 0 && is.get() != ',') {
+ is.setstate(std::istream::failbit);
+ break;
+ }
+ int numeric;
+ is >> numeric;
+ board[i] = numeric;
+ }
+ return is;
+}