913 this.brd = { aa: 0, ab: 0, ac: 0, ad: 0, |
913 this.brd = { aa: 0, ab: 0, ac: 0, ad: 0, |
914 ba: 0, bb: 0, bc: 0, bd: 0, |
914 ba: 0, bb: 0, bc: 0, bd: 0, |
915 ca: 0, cb: 0, cc: 0, cd: 0, |
915 ca: 0, cb: 0, cc: 0, cd: 0, |
916 da: 0, db: 0, dc: 0, dd: 0 }; |
916 da: 0, db: 0, dc: 0, dd: 0 }; |
917 } |
917 } |
918 BoardObj.arrMap = [["aa", "ab", "ac", "ad"], ["ba", "bb", "bc", "bd"], ["ca", "cb", "cc", "cd"], ["da", "db", "dc", "dd"]]; |
918 BoardObj.dim2Map = [["aa", "ab", "ac", "ad"], ["ba", "bb", "bc", "bd"], ["ca", "cb", "cc", "cd"], ["da", "db", "dc", "dd"]]; |
919 /** Get [i][j] element. */ |
919 /** Get [i][j] element. */ |
920 BoardObj.prototype.get = function(i, j) { |
920 BoardObj.prototype.get = function(i, j) { |
921 return this.brd[BoardObj.arrMap[i][j]]; |
921 return this.brd[BoardObj.dim2Map[i][j]]; |
922 } |
922 } |
923 /** Set [i][j] element. */ |
923 /** Set [i][j] element. */ |
924 BoardObj.prototype.set = function(i, j, val) { |
924 BoardObj.prototype.set = function(i, j, val) { |
925 this.brd[BoardObj.arrMap[i][j]] = val; |
925 this.brd[BoardObj.dim2Map[i][j]] = val; |
926 } |
926 } |
927 /* Return and optionally fill 2d board. |
927 /* Return and optionally fill 2d board. |
928 * Doesn't designed to be efficient. */ |
928 * Doesn't designed to be efficient. */ |
929 BoardObj.prototype.exportTo = function(brd) { |
929 BoardObj.prototype.exportTo = function(brd) { |
930 brd = brd || [[],[],[],[]]; |
930 brd = brd || [[],[],[],[]]; |