{
"info": {
"author": "Alberto Pettarin",
"author_email": "alberto@albertopettarin.it",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: End Users/Desktop",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Topic :: Desktop Environment",
"Topic :: Games/Entertainment",
"Topic :: Games/Entertainment :: Board Games",
"Topic :: Games/Entertainment :: Puzzle Games",
"Topic :: Utilities"
],
"description": "elzzur\n======\n\n**elzzur** solves a Ruzzle board, listing all the valid words with their\nscores.\n\n- Version: 0.0.1\n- Date: 2016-05-11\n- Developer: `Alberto Pettarin `__\n- License: the MIT License (MIT)\n- Contact: `click here `__\n\nUsage\n-----\n\n::\n\n $ python -m elzzur --help\n $ python -m elzzur solve -l language -b board [-d dictionary] [OPTIONS] \n $ python -m elzzur demo -l language \n $ python -m elzzur languages \n $ python -m elzzur cat -d dictionary [-o output]\n $ python -m elzzur compile -d dictionary -o output\n $ python -m elzzur generate -l language [-r rows] [-c columns] [-o board]\n\nIn demo mode elzzur will solve a built-in real board for the given\nlanguage.\n\nIf you do not specify a dictionary file, the built-in dictionary for the\ngiven language will be used.\n\nExamples\n--------\n\n.. code:: bash\n\n $ python -m elzzur demo -l en \n $ python -m elzzur solve -l en -b /path/to/en.board \n $ python -m elzzur solve -l en -b /path/to/en.board -d /path/to/your.dict.txt\n $ python -m elzzur solve -l it -b /path/to/it.board -d /path/to/your.dict.marisa \n\nOutput (board, list of words, statistics):\n\n.. code:: bash\n\n $ python -m elzzur demo -l en\n\n Ttl R S Ndl \n Odw Htw E I \n Cdw I N V \n Etl A D E \n\n COHESIVE 224 (2,0) (1,0) (1,1) (1,2) (0,2) (1,3) (2,3) (3,3)\n HEROIC 154 (1,1) (1,2) (0,1) (1,0) (2,1) (2,0)\n CHORES 154 (2,0) (1,1) (1,0) (0,1) (1,2) (0,2)\n COHEN 149 (2,0) (1,0) (1,1) (1,2) (0,3)\n ECHO 144 (3,0) (2,0) (1,1) (1,0)\n ...\n IA 2 (2,1) (3,1)\n ES 2 (1,2) (0,2)\n ER 2 (1,2) (0,1)\n AN 2 (3,1) (2,2)\n AI 2 (3,1) (2,1)\n\n Number of words: 281\n Length of the longest word: 8\n Maximum total score: 7376\n\nSee the `OUTPUT file `__ for the full output.\n\nInstallation\n------------\n\n.. code:: bash\n\n $ pip install elzzur\n\nor\n\n.. code:: bash\n\n $ git clone https://github.com/pettarin/elzzur\n $ cd elzzur\n $ python setup.py install\n\nYou need the ``marisa-trie`` Python package to run elzzur\n(``pip install marisa-trie``).\n\nScoring Rules\n-------------\n\n1. Only words in the given dictionary are valid.\n2. Only words at least two letters long are valid.\n3. A snake (i.e., a sequence of adjacent letters) cannot intersect\n itself, that is, each board cell can be used at most once per snake.\n4. Only one snake per word counts, that is, only the first snake forming\n a word will get points.\n5. The score of a snake is the sum of the scores of its letters (each\n multiplied by its letter multiplier, if any), times the product of\n the word multipliers (if any), plus the word length points.\n6. The word length points are: 25 for 9-letter words, 20 for 8, 15 for\n 7, 10 for 6, 5 for 5, 0 for all the other cases.\n\nAvailable Languages\n-------------------\n\nThe following languages are supported, which means that the code\nincludes a sample board, letter score, and letter frequency for each of\nthem:\n\n- ``de``\n- ``en``\n- ``es``\n- ``fr`` (letter score TBC)\n- ``it``\n- ``nl``\n- ``pt`` (letter score TBC)\n\nAdding A New Language\n~~~~~~~~~~~~~~~~~~~~~\n\nYou need to modify the ``elzzur/languages.py``. Specifically, you need\nto edit the following constants:\n\n1. ``LANGUAGES``: add your language code, say ``zz``;\n2. ``LETTER_SCORE``: add the score of each letter for language ``zz``;\n3. ``LETTER_FREQUENCY``: add the frequency of each letter in language\n ``zz``, normalizing Unicode and case.\n\nYou should also provide a real board file ``zz.board``, and the\n``zz.marisa`` dictionary derived from ``aspell-zz``.\n\nIf you add a new language, please open a pull request, so that everyone\ncan get it!\n\nDictionary File Format\n----------------------\n\nThe dictionary file must be a plain text, UTF-8 encoded file, with one\nword per line:\n\n::\n\n a\n A\n AA\n AAA\n Aachen\n aah\n Aaliyah\n ...\n\nThe words will undergo `Unicode\nNFKD `__ and `case\nnormalization `__,\nresulting in a dictionary of (uppercased) ASCII words. For example, the\nItalian word ``caff\u00e8`` (coffee) will become ``CAFFE``.\n\nAlternatively, dictionary files can be compiled MARISA files, which are\nbinary serializations of MARISA tries (see Section `Solver\nStrategy <#solver-strategy>`__ for details). Providing the dictionary in\nthis format will make the loading time shorter. To compile a plain text\ndictionary into a MARISA binary dictionary, you can invoke:\n\n::\n\n $ python -m elzzur compile -d /path/to/plain/dictionary -o /path/to/output.marisa\n\nPlease note that you need to specify the ``.marisa`` extension for\nelzzur to load the file as a MARISA trie. Otherwise, it will try to read\nit as a plain text file, failing.\n\nBoard File Format\n-----------------\n\nThe board file must be an ASCII file, containing one line per board row,\nwith letters separated by one space (or more, as multiple spaces are\ncounted as one), for example:\n\n::\n\n Ttl R S Ndl\n Odw Htw E I\n Cdw I N V\n Etl A D E\n\nThe board can have dimensions ``NxM``, with ``N >= 1, M >= 1``, not just\n``4x4``, under the constraint that all the rows must have the same\nnumber of columns (letters), that is, the board cannot contain holes.\n\nThe multipliers, if present, must be appended to the corresponding\nletter, using the following codes:\n\n- ``tw``: triples the value of the word\n- ``dw``: doubles the value of the word\n- ``tl``: triples the value of the letter\n- ``dl``: doubles the value of the letter\n\nYou can generate a random board with:\n\n::\n\n $ python -m elzzur generate -l language [-r rows] [-c cols] [-o outputfile]\n\nSolver Strategy\n---------------\n\nThe current implementation solves a given board in three steps:\n\n1. it finds all the valid snakes, that is, all the adjacent sequences of\n letters corresponding to a valid word in the dictionary;\n2. for each word, it keeps only the snake with the highest score; and\n3. it sorts the words (and the corresponding highest scoring snake),\n according to the method requested by the user: score, word length,\n word start cell, word end cell.\n\nTo find all the valid snakes, a BFS exploration of the board is\nperformed (simulated with a queue), avoiding extending the current snake\nif either:\n\n1. the snake will self-intersect or,\n2. the word corresponding to the current snake is not a prefix of any\n word in the dictionary.\n\nClearly, the crucial point consists in speeding the prefix testing up.\nHence, the dictionary is stored in memory as a MARISA trie (either\nloaded from a serialized trie version, or converted from a plain text\nfile).\n\nA `MARISA\ntrie `__ is a\nvery efficient trie (prefix tree), in terms of both storage space and\npreprocessing/running time. In particular, it guarantees that the\nfollowing operations are extremely fast:\n\n1. ``has_keys_with_prefix(prefix)``\n2. ``keys_with_prefix(prefix)``\n3. ``has_key(key)``\n\nThe `Python module `__\n``marisa-trie`` is based on the `original\nC++ `__ MARISA code.\n\nCurrently, elzzur can solve a 4x4 board in less than 100ms, and a 10x10\nboard in about 5s.\n\nTODO List\n---------\n\n- Let the user run with a new language without editing the source code\n- Let the user alter the letter scores without editing the source code\n- Let the user specify the letter scores directly in the board file\n- Some languages have letters other than ``A-Z``\n- Generalize the game to be case-sensitive\n- Generalize the game to allow self-intersecting snakes\n- Generalize the game to allow holes in the board\n- Better random board generation, e.g. based on N-grams and/or\n vocabulary\n- Given a board (hence, the letters and their number of repetitions),\n one can prune the dictionary trie, excluding words that cannot be\n formed with the given available letters\n- Confirm letter scores for ``fr`` and ``pt``\n- Confirm length points for words longer than 9 letters\n- Define rules and scores outside the code, using some format/lib TBD\n- Nicer command line interface, e.g. better argparse and examples\n\nLicense\n-------\n\n**elzzur** is released under the MIT License.\n\nThe included MARISA dictionaries ``res/*.marisa`` were compiled from the\ncorresponding `GNU aspell `__ dictionaries, and they\nare released under the same license, that is, the GNU GPL v2 License,\nsee the `licenses `__ directory.\n\n`Ruzzle `__ is a product of MAG\nInteractive(TM).\n\nAcknowledgments\n---------------\n\n- My sister and nephews for introducing me to Ruzzle",
"description_content_type": null,
"docs_url": null,
"download_url": "UNKNOWN",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/pettarin/elzzur",
"keywords": "elzzur,Ruzzle,Ramble,Scrabble,Scarabeo,Paroliere,Snake,board,snake,snakes,solve,solver,MARISA,trie,prefix tree",
"license": "MIT License",
"maintainer": null,
"maintainer_email": null,
"name": "elzzur",
"package_url": "https://pypi.org/project/elzzur/",
"platform": "UNKNOWN",
"project_url": "https://pypi.org/project/elzzur/",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "https://github.com/pettarin/elzzur"
},
"release_url": "https://pypi.org/project/elzzur/0.0.1.0/",
"requires_dist": null,
"requires_python": null,
"summary": "elzzur solves a Ruzzle board, listing all the valid words with their scores.",
"version": "0.0.1.0"
},
"last_serial": 2110465,
"releases": {
"0.0.1.0": [
{
"comment_text": "",
"digests": {
"md5": "b790af6d9549b583a2020d4d1a99daaf",
"sha256": "0596ef9cc52c9872c04977a493edbccccd4b5065f2b302daf1fd7c96fa13a5f0"
},
"downloads": -1,
"filename": "elzzur-0.0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "b790af6d9549b583a2020d4d1a99daaf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3366494,
"upload_time": "2016-05-11T11:56:06",
"url": "https://files.pythonhosted.org/packages/56/f2/da03aa39ddc5f2a3229c7b67b31b5bcb2f37843bbebff5821ade67f13bc1/elzzur-0.0.1.0.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "b790af6d9549b583a2020d4d1a99daaf",
"sha256": "0596ef9cc52c9872c04977a493edbccccd4b5065f2b302daf1fd7c96fa13a5f0"
},
"downloads": -1,
"filename": "elzzur-0.0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "b790af6d9549b583a2020d4d1a99daaf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3366494,
"upload_time": "2016-05-11T11:56:06",
"url": "https://files.pythonhosted.org/packages/56/f2/da03aa39ddc5f2a3229c7b67b31b5bcb2f37843bbebff5821ade67f13bc1/elzzur-0.0.1.0.tar.gz"
}
]
}