Giter Club home page Giter Club logo

crossword-unicode's Introduction

Crossword

Make crossword puzzles in multiple languages and scripts.

Burmese/Myanmar Version supporting Unicode and Zawgyi fonts.

Also in Nepali and Tamil

Nepali Version including Preeti font

Tamil Version

Usage

Client-side javascript

var game = new Crossword(HTML5canvas, columns, rows);
game.clearCanvas(true);

var clue = 'What does a duck say?';
var answer = 'quack';

game.addWord(answer, function(error, clueAnchor, direction) {
  // error is null or an error (answer is too small, too big, cannot be placed etc)
  // clueAnchor is the number used by the system (for example "2" for "2 across")
  // direction is "across" or "down"
});

// advanced language options
game.setNumberTransform(function (n) {
  // convert integer marker to local language
  return tamilNumbers(n);
});

Node module

Using the crossword module requires node-canvas.

Installation pre-requisites:

npm install canvas crossword --save
var Canvas = require('canvas');
var Crossword = require('crossword');

var width = 20;
var height = 15;
var canv = new Canvas(40 * width, 40 * height);

var game = new Crossword(canv, width, height);
game.clearCanvas(true);

game.addWord(answer, function(err, clueAnchor, direction) {
  // err = null
  // clueAnchor = 2
  // direction = 'down' or 'across'
});

// right-to-left scripts (Arabic, Hebrew, Divehi)
// in these cases down = top->down, across = right->left
game.setDirection('rtl');

Command Line

Make crosswords from a word list using command line.

Prerequisites: NodeJS and fonts which support your language (preferably Noto Sans Myanmar, Noto Sans Devanagari, and Noto Sans Tamil, included in the styles directory of this project)

npm install crossword -g
crosswordjs wordlist.txt output.png

# command-line setup
# 20 columns wide, 15 rows high
# Myanmar numerals (other numerals supported: ne Nepali / Devanagari, ta Tamil, ar Arabic (also changes direction))
xwordjs wordlist.txt output.png -w 20 -h 15 -l my

Built with open source software

License

Open source, MIT license

crossword-unicode's People

Contributors

mapmeld avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

crossword-unicode's Issues

Add requirements

Please mention these pre-requirements in the readme:
https://github.com/Automattic/node-canvas/wiki/Installation---OSX
brew install pkg-config pixman cairo

Otherwise one will end up with:

λ ~/ master* npm i -g crossword
/Users/howard/.nvm/versions/node/v5.5.0/bin/crosswordjs -> /Users/howard/.nvm/versions/node/v5.5.0/lib/node_modules/crossword/cli.js

> [email protected] install /Users/howard/.nvm/versions/node/v5.5.0/lib/node_modules/crossword/node_modules/canvas
> node-gyp rebuild

Package cairo was not found in the pkg-config search path.
Perhaps you should add the directory containing `cairo.pc'
to the PKG_CONFIG_PATH environment variable
No package 'cairo' found
gyp: Call to './util/has_lib.sh freetype' returned exit status 0. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/Users/howard/.nvm/versions/node/v5.5.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:355:16)
gyp ERR! stack     at emitTwo (events.js:100:13)
gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.3.0
gyp ERR! command "/Users/howard/.nvm/versions/node/v5.5.0/bin/node" "/Users/howard/.nvm/versions/node/v5.5.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/howard/.nvm/versions/node/v5.5.0/lib/node_modules/crossword/node_modules/canvas
gyp ERR! node -v v5.5.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organiszation’s settings page, under Installed GitHub Apps.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organiszation’s settings page, under Installed GitHub Apps.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

Help with displaying resulting crossword riddle

Hi,
this project looks very cool and I'd like to generate some crossword riddles for young students!
Is there a full usage example that also includes rendering the canvas? Maybe this is not part of what this package can do? I would like to export or at least be able to see the resulting crossword riddle. What I have so far (and I'm running it in the powershell under windows):
`var Canvas = require('canvas');
var Crossword = require('crossword');

var width = 20;
var height = 15;
var canv = new Canvas(40 * width, 40 * height);

var game = new Crossword(canv, width, height);
// right-to-left scripts (Arabic, Hebrew, Divehi)
// in these cases down = top->down, across = right->left
game.setDirection('ltr');
game.clearCanvas(true);

var words = [];

words.push("schultuete")
words.push("turnsackerl")
words.push("lehrerin")
words.push("tafel")
words.push("jause")
words.push("bleistift")
words.push("turnsaal")
words.push("buecher")
words.push("kreide")
words.push("lineal")
words.push("schultasche")
words.push("schere")
words.push("fuellfeder")
words.push("landkarte")

words.forEach(element => {
game.addWord(element, function(err, clueAnchor, direction) {
if(err){console.log(err)}
console.log(element)
console.log(direction)
// direction = 'down' or 'across'
});
});`

Thanks for any hints!

Kind regards,
Stefan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.