bunkat / wordfind Goto Github PK
View Code? Open in Web Editor NEWA small javascript library for generating and solving word find (also known as word search) puzzles.
License: MIT License
A small javascript library for generating and solving word find (also known as word search) puzzles.
License: MIT License
Hello, I've set preferOverlap to false, within the wordfind.js file but its still overlapping when generating the wordsearch, am I missing something or am I suppose to put preferOverlap somewhere else?
file: wordfindgame.js
function: touchMove, line107
problem: the touch events do not register on the grid
fix: change var targetElement = document.elementFromPoint(xPos, yPos); select(targetElement)
TO select(document.elementFromPoint(xPos, yPos));
Because variable targetElement is giving null.
The solve display need to find all the buttons created with an automated created class with the text to find. So, if your page uses this class to display some elements that are not in the puzzle, thoses elements will get the "wordFound" class.
The first time you solves the puzzle everything is good. but if you want to dynamically rgenerate another puzzle, without reloading your html page, then the solve script does not word anymore on the texte to find, which correspond to the className.
I've changed in wordfindgame.js the solve script in order to set the class "wordFound" only into the div containing te puzzle, whatever this div id can be. here is the code :
` solve: function(puzzle, words) {
var solution = wordfind.solve(puzzle, words).found;
// recherche l'element qui contient le puzzle
var elem_puzzle = $('[x="0"][y="0"]').parent().parent().attr('id')
for (var i = 0, len = solution.length; i < len; i++) {
var word = solution[i].word,
orientation = solution[i].orientation,
x = solution[i].x,
y = solution[i].y,
next = wordfind.orientations[orientation];
if (!$('#'+elem_puzzle + '.' + word).hasClass('wordFound')) {
for (var j = 0, size = word.length; j < size; j++) {
var nextPos = next(x, y, j);
$('[x="' + nextPos.x + '"][y="' + nextPos.y + '"]').addClass('solved');
}
$('#'+ elem_puzzle +' .' + word).addClass('wordFound');
}
}
},
Hope it helps`everybody
I love this wordfind game and have several puzzles at http://phaedrus.hopto.org/games/wordfind.
I like to put up a background image related to the word category but it often makes the words too hard to read.
Is there a way to create a background color behind the puzzle words on the right?
Thank you,
Cy Kurtz
When puzzle is filled with random characters ,sometimes a word occurs twice.
Am I missing something?
It does not support cross-browser compatibility
I am trying to demo this but it is not letting me find a word when I drag. Any idea as to whats going on?
Is this browser specific? or should it work on all browsers?
Hi.
Because I made the mistake of adding some extra commits on my fork branch used in PR #12 before you merged it, your original README has been replaced by mine :(
Sorry about that. Restoring the previous version should only be a matter of: git reset --hard HEAD^^^^^^ README.md
My name has also been added index.html
: feel free to remove it.
Wondering if there is way to indicate the preference of having a diagonal (or any other) direction?
Orientation not working
Hi,
The orientations parameter is not working for me.
I have tried to set only horizontal and both horizontal and vertical, but in both cases the words are spread using other options (horizontalBack, verticalUp, diagonal, etc).
Thanks,
UPDATE [Problem solved]
I was declaring two different things (the wordfind and the puzzle) and setting the properties at the wrong place:
var gamePuzzle = wordfindgame.create(words, '#puzzle', '#words');
var puzzle = wordfind.newPuzzle(words, { orientations: ['horizontal', 'vertical'] });
So I took a look inside the .js files and found out that only declaring wordfindgame.create
will do all the job, so it worked when I changed to:
var puzzleOptions = { orientations: ['horizontal', 'vertical'] };
var gamePuzzle = wordfindgame.create(words, '#puzzle', '#words', puzzleOptions);
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.