--- a/board.js Fri Sep 26 02:21:28 2014 +0300
+++ b/board.js Fri Sep 26 09:53:50 2014 +0300
@@ -34,6 +34,20 @@
&& from[8] === to[8] && from[9] === to[9] && from[10] === to[10] && from[11] === to[11]
&& from[13] === to[13] && from[14] === to[14];
}
+BoardArr.prototype.compress = function() {
+ var brd = this.brd;
+ var h1 = 0;
+ for (var j = 0; j < 4; j++)
+ h1 = (h1 << 4) | brd[0][j];
+ for (var j = 0; j < 4; j++)
+ h1 = (h1 << 4) | brd[1][j];
+ var h2 = 0;
+ for (var j = 0; j < 4; j++)
+ h2 = (h2 << 4) | brd[2][j];
+ for (var j = 0; j < 4; j++)
+ h2 = (h2 << 4) | brd[3][j];
+ return [h1, h2];
+}
/* Return and optionally fill 2d board.
* Doesn't designed to be efficient. */
BoardArr.prototype.exportTo = function(brd) {