michaelwehar / crossword-layout-generator Goto Github PK
View Code? Open in Web Editor NEWCrossword Layout Generator - Open Source
Home Page: http://michaelwehar.com/crosswords
License: MIT License
Crossword Layout Generator - Open Source
Home Page: http://michaelwehar.com/crosswords
License: MIT License
Hi,
Thanks for this code but how can I parse the json to get it displayed like you showed in the picture?
Thanks
Occasionally two words in the same direction overlap. For example:
{
clue: 'just born',
answer: 'baby',
orientation: 'down',
startx: 16,
starty: 15
}
{
clue: 'feline',
answer: 'cat',
orientation: 'down',
startx: 16,
starty: 14,
}
For some reason with these specific words it happens nearly all of the time:
baby, cat, nicotine, chocolate
Baby and cat consistently overlap as do nicotine and chocolate.
For now I am doing manual checks to ensure this doesn't happen, but I'm stumped as to what's going on here.
I am currently generating the crosswords by selecting 5 random words from the following:
baby, cat, university, nicotine, chocolate, cactus, aquarium. The two aforementioned pairs consistently overlap when they are selected regardless of the other words.
I have been trying my best to convert the code to gdscript (scripting language used in the Godot game engine), but the result are not exactly as the JavaScript's
Currently, the layout generator will sometimes add isolated words and smaller isolated word islands to the layout. In some cases, we want to maximize the number of words that we fit in the grid. However, I think that in general we might want to remove isolated words and small word islands.
I suggest that there should be an option that (if set) will automatically remove isolated words. Also, there could be a parameter for removing small word islands that contain fewer than the parameter many words.
Some of the code is a bit cryptic. Maybe we could restructure it and add more explanation so that it's easier to understand so that others can contribute more easily.
Is it possible to add a way to limit the generated crossword to specific bounds eg. a 15 by 15 crossword?
In layout_generator.js, we call the Object.keys method.
Object.keys is supported in ES5-compatible environments, but might not be supported in other environments.
Hi
Thanks for your cool script. It's exactly what I need for my personal project. Do you have any plans about releasing the package on npmjs?
It would really simplify development and deployment.
Thanks in advance
Michael
When building a crossword layout, the generator makes a sequence of decisions. Each decision is greedily made to maximize a hard coded function.
The hard coded function incentivizes number of connections between words, longer words first, equal number of vertical and horizontal words, and word placement near the center.
Let's call the hard coded function our fitness function (even though it might not be a conventional fitness function).
Goal: Evaluate the performance of our crossword layout generator's fitness function.
Here are some things that we can do to help us meet our goal.
I am facing an issue with handling crossword layout size. because sometimes crossword sizes are larger to handle please suggest possible solution
when I change the order of the objects {answer: 'xxx', clue: 'yyy} within the input array to the main generateLayout() function I get a different layout.
considering the fitness function - could be that a different order of the input will yield a better layout ?
I want to recreate a crossword grid using only the answers. As a test I am using answers from a known grid (15x15 blocked crossword).
I input the answers, but the created grid does not match the known grid and is too big.
I have set:
var rows = 15;
and
var table = generateTable(blankTable, rows, cols, words, [0, 0, 0, 0]);
in
function generateSimpleTable(words)
which makes a better match, but not identical.
What else do I need to change to make this work?
Thank you.
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.