Skip to content

HartasCuerdas/xwHelper

Repository files navigation

xwHelper

Crossword Helper

Live Demo

This helper is not intended to be useful as a crossword solver. this helper does not handle clues and clues numbers relation.

This application is useful if you want to replicate a crossword from paper or digital image (jpg, png, any image or photo).

The default grid is 15x15 (standard for quick crossword and cryptic crossword). This default dimension can be changed from code.

For the development it was reviewed the codebase of Crossword by Jesse Weisbeck. The useful code for this basic helper are the related to building the grid (html table TDs and INPUTs) and navigation (key event delegation). Notes about jweisbeck/Crossword codebase: Objects, functions, etc.

Move through board using arrow keys (left, right, up and down).

TIP: Use capital characters (caps lock)

To insert number references on a square just type the number.

Use SPACEBAR to make a square checked (black), SPACEBAR again to make it white. Use also SPACEBAR to delete number references to clues, e.g. when you mistake when typing.

Black shaded and white squares, FAST configuration

A matrix can be included for automatically configurate white and black squares. Matrix looks like the following:

var squareMatrix =
[
 [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1],
 [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
 [ 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],
 [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
 [ 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1],
 [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
 [ 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1],
 [ 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1],
 [ 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0],
 [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
 [ 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
 [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
 [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1],
 [ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1],
 [ 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
];

Matrix can be generated by hand or BETTER from digital image (png, jpg) using HartasCuerdas/xwbinarier pyhton script. This uses OpenCV.

Squares with numbers (references to clues) can be configurated in a similar way.

var numMatrix =
[
 [  1,  0,  2,  0,  3,  0,  4,  0,  5,  0,  0,  6,  7,  0,  8],
 [  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0],
 [ 10,  0,  0,  0,  0,  0, 11,  0,  0,  0,  0,  0,  0,  0,  0],
 [  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
 [ 12,  0,  0,  0,  0,  0,  0, 13,  0,  0,  0,  0,  0,  0,  0],
 [  0,  0,  0,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,  0],
 [  0, 15,  0,  0,  0,  0,  0,  0,  0, 16,  0,  0,  0,  0,  0],
 [ 17,  0,  0,  0,  0,  0,  0,  0, 18,  0,  0,  0, 19,  0,  0],
 [  0,  0,  0, 20, 21,  0,  0,  0, 22,  0, 23,  0,  0,  0,  0],
 [  0,  0, 24,  0,  0,  0, 25,  0,  0,  0,  0,  0,  0,  0, 26],
 [ 27,  0,  0,  0,  0,  0,  0,  0,  0, 28,  0,  0,  0,  0,  0],
 [  0,  0,  0,  0,  0,  0,  0,  0, 29,  0,  0,  0,  0,  0,  0],
 [ 30,  0,  0,  0,  0,  0,  0,  0,  0,  0, 31,  0,  0,  0,  0],
 [  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
 [ 32,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0,  0,  0,  0]
];