|
|
@@ -9,6 +9,18 @@ GridCell.prototype.toStatic = function() {
|
|
|
return { x: this.px, y: this.py };
|
|
|
};
|
|
|
|
|
|
+function EmptyCell(x, y) {
|
|
|
+ GridCell.call(this, x, y);
|
|
|
+}
|
|
|
+EmptyCell.prototype = Object.create(GridCell);
|
|
|
+EmptyCell.prototype.constructor = EmptyCell;
|
|
|
+
|
|
|
+EmptyCell.prototype.toStatic = function() {
|
|
|
+ var ret = GridCell.prototype.toStatic.call(this);
|
|
|
+ ret["type"] = null;
|
|
|
+ return ret;
|
|
|
+};
|
|
|
+
|
|
|
function LetterCell(x, y, letter) {
|
|
|
GridCell.call(this, x, y);
|
|
|
this.letter = letter;
|
|
|
@@ -136,7 +148,7 @@ function parseGrid(grid, definitions, w, h) {
|
|
|
if (c == c.toUpperCase()) {
|
|
|
resultGrid.push(new LetterCell(j, i, c));
|
|
|
} else if (c == 'z') {
|
|
|
- resultGrid.push(null);
|
|
|
+ resultGrid.push(new EmptyCell(j, i));
|
|
|
} else {
|
|
|
let cell = new DefinitionCell(j, i, c.charCodeAt(0) -firstCharCode, definitions, currentDefinition);
|
|
|
currentDefinition += cell.definitions.length;
|
|
|
@@ -166,7 +178,7 @@ Grid.prototype.toStatic = function(v) {
|
|
|
}
|
|
|
var grid = [];
|
|
|
this.grid.forEach((cell) => {
|
|
|
- if (cell instanceof DefinitionCell && !v) {
|
|
|
+ if ((cell instanceof DefinitionCell || cell instanceof EmptyCell) && !v) {
|
|
|
grid.push(cell.toStatic());
|
|
|
} else if (cell instanceof LetterCell && cell.found && cell.v >= v) {
|
|
|
grid.push(cell.toStatic());
|