Giter VIP home page Giter VIP logo

crossword-generator's Introduction

CWG

try crossword-generator online

NPM

cmd+r

5 different crosswords generated by CWG

use

yarn dev

import CWG from 'cwg'

const words = [
  'do',
  'not'
]

const result = CWG(words) // then you can draw the crossword by this result

result parameters

// console.log(result)
{
  height: 2,            // height of the matrix
  width: 3,             // width of the matrix
  positionObjArr: [     // position of each input word, as input's order
    {
      wordStr: 'do',    // string of word
      xNum: 1,          // begin position x
      yNum: 0,          // begin position y
      isHorizon: false  // horizontal or vertical
    },
    {
      wordStr: 'not',
      xNum: 0,
      yNum: 1,
      isHorizon: true
    }
  ],
  ownerMap: [           // matrix of the crossword
    [
      empty,            // [0, 0]
      {                 // [0, 1]
        letter: 'd',    // letter of this position
        vertical: 0     // which word this letter belongs to. in this case, it's 0th: 'do'
      },
      empty             // [0, 2]
    ],
    [
      { letter: "n", horizontal: 1 },              // [1, 0]
      { letter: "o", vertical: 0, horizontal: 1 }, // letter of [1, 1] belongs to both words
      { letter: "t", horizontal: 1 }               // [1, 2]
    ]
  ]
}

todo

  • handle no-result words
  • do not sort the input array at the beginning

crossword-generator's People

Contributors

gaoryrt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

crossword-generator's Issues

incorrect result in RTL languages

in RTL languages vertical words are fine but horizontal words are placed in reverse leading to meaningless words when combined with vertical words.

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.