Skip to content

Commit

Permalink
Bugfix: Grid labels correctly counted and assigned.
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranking committed Nov 8, 2017
1 parent 3abe630 commit b7a683b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
12 changes: 7 additions & 5 deletions cross.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,15 @@ function createGrid(rows, cols) {

function updateLabelsAndClues() {
let count = 1;
let increment = false;
const grid = document.getElementById("grid");

for (let i = 0; i < xw.rows; i++) {
for (let j = 0; j < xw.cols; j++) {
let isAcross = i == 0 || xw.fill[i - 1][j] == BLACK;
let isDown = j == 0 || xw.fill[i][j - 1] == BLACK;
let isAcross = false;
let isDown = false;
if (xw.fill[i][j] != BLACK) {
isDown = i == 0 || xw.fill[i - 1][j] == BLACK;
isAcross = j == 0 || xw.fill[i][j - 1] == BLACK;
}
const grid = document.getElementById("grid");
let currentCell = grid.querySelector('[data-row="' + i + '"]').querySelector('[data-col="' + j + '"]');
if (isAcross || isDown) {
currentCell.firstChild.innerHTML = count; // Set square's label to the count
Expand Down
3 changes: 2 additions & 1 deletion files.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ function convertJSONToPuzzle(puz) {
xw.fill = new_fill;
isMutated = true;

// updateUI();
updateGridUI();
updateLabelsAndClues();
// Load in clues and display current clues
for (let i = 0; i < xw.rows; i++) {
for (let j = 0; j < xw.cols; j++) {
Expand Down
3 changes: 2 additions & 1 deletion xw_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ onmessage = function(e) {
console.log('calling main');
let args = ['-no-pre', '/wordlist', '/puz'];
if (isQuick) {
args.splice(0, 0, '-compute-forced', '-thresh1=13', '-thresh2=10');
// args.splice(0, 0, '-compute-forced', '-thresh1=13', '-thresh2=10');
args.splice(0, 0, '-thresh1=13', '-thresh2=10');
}
Module.callMain(args);
break;
Expand Down

0 comments on commit b7a683b

Please sign in to comment.