jweisbeck / crossword Goto Github PK
View Code? Open in Web Editor NEWA javascript crossword puzzle script
Home Page: http://www.jesseweisbeck.com/crossword/
A javascript crossword puzzle script
Home Page: http://www.jesseweisbeck.com/crossword/
Thank you for releasing your fun crossword code under a free licence.
Please consider supporting deployment of this application on Sandstorm:
Sandstorm is a SaaP (Software as a Platform) for easily deploying server applications.
This would mean that it would be very simple for somebody unskilled in computers to enjoy using your work.
PS
Non-Free Javascript test
If you have time, could you please check whether your code passes the GNU IceCat browser non-free javascript check, that would be great. Thank you.
Hi folks
Not an issue, but PR's don't seem to be looked at - hope this helps.
Tell me if I'm doing this wrong - very new to GH. Just want to share my solution.
Have been working on this over last couple of days, and needed a way to show the attempts made on the puzzle.
If you paste this function into the puzInit var, as the puzzle is generated, it'll fill in the user's attempts.
showAttempts: function() {
//console.log("entries",entries); // co-ords of cell - col,row, ["1,1", "2,1", "3,1", "4,1"]
for (var x=1, p = entryCount; x <= p; ++x) {
//var letters = puzz.data[x-1].answer.split('');
var attempt = puzz.data[x-1].attempt.split(''); // retrieved user's attempt - useful when rebuilding puzzle with user attempts
console.log(attempt);
console.log("entries["+(x-1)+"]",entries[x-1]); // co-ords of cell - col,row, ["1,1", "2,1", "3,1", "4,1"]
var y = 0;
for (var i=0; i < entries[x-1].length; ++i) {
var selector = '.position-' + (x-1) + ' input';
//console.log(selector);
var co = entries[x-1][i].split(",");
console.log("co:",co);
var c0 = co[0];
var c1 = co[1];
var r = 0;
if(c0>=c1) {
r = c0;
// try to normalise what we have
// col value appears first, and
// has the column value of the <td> element across the row
// to target it properly, if it's at say, col 6 (and its the 1st letter position of the word),
// we need to force it back to 1
var t1 = r; // could be 6
var t2 = t1 - 1; // whatever value is one less ie: 5
var t3 = (t1 - t2) + y; // ie: 6 - 5 = 1
y++;
r = t3;
} else {
r = co[1];
}
console.log("r:",r,"t1:",t1, "t2:",t2, "t3:",t3,"attempt[r-1]",attempt[r-1],"attempt[t3-1]",attempt[t3-1]);
$(selector)[r-1].value = attempt[r-1];
}
}
},
This bit:
var attempt = puzz.data[x-1].attempt.split(''); // retrieved user's attempt - useful when rebuilding puzzle with user attempts
console.log(attempt);
requires that a key in the json puzzleData variable called "attempt" have the users attempt at this clue.
So, for example:
var puzzleData = [
{
clue: "my first name",
answer: "brad",
attempt: "blah",
position: 1,
orientation: "across",
startx: 1,
starty: 1
},
{
clue: "my wife's first name",
answer: "nottellingyou",
attempt: "abcdefghijklm",
position: 2,
orientation: "across",
startx: 6,
starty: 1
},
{
clue: "opposite of above",
answer: "below",
attempt: "below",
position: 1,
orientation: "down",
startx: 1,
starty: 1
},
]
Oh! One last thing:
In var puzInit = {, right at the bottom, add puzInit.showAttempts() as below:
puzInit.buildTable();
puzInit.buildEntries();
puzInit.showAttempts();
If you edit the puzzle data in this repo and add a key called "attempt" with some value in each json entry, give it a whirl! It worked for me.
Hope this helps!
You done a very good work. Do you have some clue to develop a "puzzleData" (from script.js) generator
Hi,
i liked your your crossword thing, i have list of questions with answers to make crossword puzzle. so, how i can generate puzzleData which is you prepared in script.js file.
Hello, I want to disable ALT key in crossword. ALT is using for make polish letter. When I am make polish letter the spaces move about 3 field.
Hey, I'm having issue with the responsive design. Do you have any solution?
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?
at Function.Sizzle.error (jquery-7d5ba98….js?body=1:1492)
at Sizzle.tokenize (jquery-7d5ba98….js?body=1:2109)
at Sizzle.select (jquery-7d5ba98….js?body=1:2513)
at Function.Sizzle [as find] (jquery-7d5ba98….js?body=1:889)
at jQuery.fn.init.find (jquery-7d5ba98….js?body=1:2729)
at jQuery.fn.init (jquery-7d5ba98….js?body=1:2846)
at jQuery (jquery-7d5ba98….js?body=1:74)
at Object.buildEntries (jquery.crossword-39e9068….js?body=1:244)
at Object.init (jquery.crossword-39e9068….js?body=1:171)
at jQuery.fn.init.$.fn.crossword (jquery.crossword-39e9068….js?body=1:551)
Hello, I am trying to make an upgraded version of this game where players can log in and play a multi player game. I am not sure how to do this. I would really appreciate if someone could guide me on this by suggesting some code snippet or tutorial.
Thanks.
What is the license for this? Can I use it in a website?
Thanks for sharing this!
I wonder about the license. Is it GPL?
Would been nice with a quick answer, so I maybe can start having some fun.
Best regards!
Hi,
I see this like give me an error on jquery 3.x
light = $(puzzCells + '[data-coords="' + entries[x - 1][i] + '"]');
I can't correct, do you ?
Please can someone says how to add a winning message after the puzzle completed?
Thank you!
How can I save the data entered in this game while playing the game LocalStorage
? To prevent the data entered from being updated while the page is up.
work awesome in desktop browser, but in iPad Safari browser there is a severe problem when re-filling letter to input box (type - delete - type again), the new letter doesn't show at all.
Hi, is there a way to get this working for jQuery 2.0.0 ?
I get this error :
Uncaught Error: Syntax error, unrecognized expression: [object Object][data-coords="2,1"]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.