Giter VIP home page Giter VIP logo

crosswordgenerator's Introduction

CrosswordGenerator

crossword_gen is a program written in C allowing to generate random crosswords from a list of words.

The following parameters are expected on the standard input:

  • Number of rows (> 0)
  • Number of columns (>= Number of rows)
  • Maximum number of black squares (>= 0)
  • Linear blacks flag (0: false, otherwise true)
  • Heuristic flag (0: false, otherwise true)

The path to the list of words to be used by the program is expected as an argument. In the list, each word must be written in uppercase (no accentuated characters allowed), one word per line.

Example (program executed under Linux)

$ echo 10 15 8 0 1 | crossword_gen my_words.txt

Means "Generate a 10x15 crossword, with 8 black squares at most, disable linear blacks, enable heuristic. Use the file my_words.txt as the list of words."

The program generates a trie from the list of words provided. The crossword is generated cell by cell, in a row scan way. At each cell the program determines the list of possible letters from the current horizontal and vertical nodes in the trie.

When a valid solution is found, the new Maximum number of squares becomes the number of those found in this solution, until it reaches 0 and the program terminates. A solution is valid if all the words found are in the list of words (including one-letter words), and there is no duplicate words on the grid.

When the Linear blacks flag is true, the program will try to put a black square at most every (Number of rows * Number of colums)/(Maximum number of black squares) cells. It means in this case the program may miss valid solutions. Otherwise a full search is always performed.

When the Heuristic flag is true, the program will sort the list of possible letters at each cell using their frequency of usage. Otherwise a shuffle of those letters is performed.

crosswordgenerator's People

Contributors

houstonwehaveabug avatar

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.