Crossword
Crossword copied to clipboard
Positions not matching
Hello!
I'm noticing a strange bug where the clue/answer positions don't match up. Although the linked demo works fine, when I clone the repo and run it locally I get this:

You'll notice that the across and down numbers don't match the clues.
Attempting to create my own crossword gives me this:

Here's the data I'm using:
testData = [
{
clue: "Rogers and Samsung collaborating to sell mobile devices to Canadian consumers is an example of a ___ ___ (two words, use a space as separator).",
answer: "strategic alliance",
position: 1,
orientation: "down",
startx: 8,
starty: 1
},
{
clue: "HBC sells clothing that are brought in from other countries. This is an example of an ______ business.",
answer: "import",
position: 2,
orientation: "down",
startx: 15,
starty: 3
},
{
clue: "Domtar Inc. sells paper and pulp products made from its Canadian plants to overseas customers. This is an example of an ______ business.",
answer: "export",
position: 3,
orientation: "down",
startx: 17,
starty: 4
},
{
clue: "A country has a trade ______ when imports exceed exports.",
answer: "deficit",
position: 4,
orientation: "down",
startx: 15,
starty: 13
},
{
clue: "Jaguar Land Rover Limited expanded into the Chinese luxury car market by partnering with local auto maker, Chery. Together, they formed a new company called Chery Jaguar Land Rover Automotive Company Limited. This is an example of a ___ ___ (two words, use a space as separator).",
answer: "joint venture",
position: 5,
orientation: "across",
startx: 6,
starty: 8
},
{
clue: "Walmart Canada would be considered a ___________ of Wal-Mart Stores Inc. in the United States.",
answer: "subsidiary",
position: 6,
orientation: "across",
startx: 1,
starty: 11
},
{
clue: "A business ______ refers to recurring periods of increased and decreased economic activity, or expansions and contractions.",
answer: "cycle",
position: 7,
orientation: "across",
startx: 5,
starty: 13
},
{
clue: "Acronym for the monetary value of all goods and services produced within a country in a given period of time.",
answer: "gdp",
position: 8,
orientation: "across",
startx: 14,
starty: 13
},
{
clue: "Any attempt to increase a business's effectiveness or overall efficiency. E.g. downsizing, cutbacks, relocating to cheaper places of labour.",
answer: "rationalization",
position: 9,
orientation: "across",
startx: 3,
starty: 16
},
{
clue: "The bottom of the business cycle.",
answer: "trough",
position: 10,
orientation: "across",
startx: 15,
starty: 19
},
]
Is there a simple solution to this bug?
I've been having this issue as well! I don't quite understand it. Hope that someone out there can help us. :)
I'm having the exact same issue. Did either of you end up figuring it out?
The solution to this is more or less just to download this fork: https://github.com/konst2/Crossword
It's significantly improved.
If you'd like to try something that accepts a list of words and a list of clue as arguments, and makes the puzzle for you, then check out this Crossword Puzzle Generator and Game I cooked up in JavaScript:
https://github.com/HoldOffHunger/jquery-crossword-puzzle-generator
Demo: http://www.earthfluent.com/crossword-puzzle-demo.html
Hope this helps!
Here's how I fixed it:
In the CalcCoords function, after the for (var x=0; j = puzz,data[i].answer.length; x < j; ++x) loop:
// while we're in here, add clues to DOM!
if(i===0) {
z = 1;
} else {
z = i;
}
$('#' + puzz.data[i].orientation).append('<li value="' + z + '" tabindex="1" data-position="' + i + '">' + puzz.data[i].clue + '</li>');
Try that - it worked for me.
Cheers
Hello Mr. Bradzo,
It is working perfectly. You are genius!!! Thanks once again.
Do you have any idea on how to accept the input non-English characters (multi-byte characters) into the single cell (td)? Suppose I want to enter answer as 'भारत'. So here letter is made up of two characters: भ +ा In Indic languages, single "letter" can be made maximum up to 3 characters.
best regards, Vidyesh
Hi Vidyesh!
Thanks!
Unfortunately, I don't have any clue about how to enter non-English characters.
If that can be achieved, the next thing is trying to ensure the puzzle can be solved. Since my solver solution (see my other comment), relies on checking each ascii character of attempted word and actual answer, if your "letter" (comprising multiple characters) can be "boiled down" to one particular unique value, then I think that could be made to work.
I'm doing this for a project I need to complete soon, so won't have any time to try that, sorry!
Cheers Brad
On Tue, 2 Mar 2021 at 17:45, vidyeshranade [email protected] wrote:
Hello Mr. Bradzo,
It is working perfectly. You are genius!!! Thanks once again.
Do you have any idea on how to accept the input non-English characters (multi-byte characters) into the single cell (td)? Suppose I want to enter answer as 'भारत'. So here letter is made up of two characters: भ +ा In Indic languages, single "letter" can be made maximum up to 3 characters.
best regards, Vidyesh
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jweisbeck/Crossword/issues/13#issuecomment-788694083, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC3SGSGZFEP25HXBMZVKJ5DTBSJRVANCNFSM4DW76EFA .
-- Bradley David Thomas Independent Software Developer https://bradzo.com.au
"No trees were harmed in the creation of this message, but several thousand electrons were mildly inconvenienced."
Hello Brad,
Thanks for the reply. I will try to figure out and if found, will post here. Best wishes for your project to complete it before time.
regards, vidyesh.