{"id":29785489,"url":"https://github.com/benjamincrom/scrabble","last_synced_at":"2025-07-27T17:11:55.080Z","repository":{"id":57464614,"uuid":"81604884","full_name":"benjamincrom/scrabble","owner":"benjamincrom","description":"Implements Scrabble.  Also allows user to recover all game moves from given board and score list as well as brute-force find best move.","archived":false,"fork":false,"pushed_at":"2023-12-20T12:38:37.000Z","size":2760,"stargazers_count":45,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-21T05:40:51.492Z","etag":null,"topics":["board-game","python-3","scrabble"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benjamincrom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-10T20:40:03.000Z","updated_at":"2025-06-12T06:35:09.000Z","dependencies_parsed_at":"2022-08-31T04:53:23.235Z","dependency_job_id":null,"html_url":"https://github.com/benjamincrom/scrabble","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/benjamincrom/scrabble","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjamincrom%2Fscrabble","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjamincrom%2Fscrabble/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjamincrom%2Fscrabble/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjamincrom%2Fscrabble/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benjamincrom","download_url":"https://codeload.github.com/benjamincrom/scrabble/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjamincrom%2Fscrabble/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266909942,"owners_count":24004774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["board-game","python-3","scrabble"],"created_at":"2025-07-27T17:11:51.011Z","updated_at":"2025-07-27T17:11:55.072Z","avatar_url":"https://github.com/benjamincrom.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"**Table of Contents**\n\n- [Scrabble](#scrabble)\n    - [Installing from pypi](#installing-from-pypi)\n    - [Installing from source](#installing-from-source)\n    - [Testing](#testing)\n    - [Recover Scrabble Game](#recover-scrabble-game)\n    - [Play Scrabble Game](#play-scrabble-game)\n        - [Create a new Scrabble game object](#create-a-new-scrabble-game-object)\n        - [Make Move](#make-move)\n        - [Find Best Move (Brute Force)](#find-best-move-brute-force)\n        - [Exchange Tiles](#exchange-tiles)\n        - [Conclude Game](#conclude-game)\n\n# Scrabble\nThis package implements the game of Scrabble and also adds features that\nrecover previous moves as well as determine the best next move for a given\nScrabble game.\n\n## Installing from pypi\n```\npip3 install scrabble\n```\n## Installing from source\n```\ngit clone git@github.com:benjamincrom/scrabble.git\ncd scrabble/\npython3 setup.py install\n```\n\n## Testing\nTests take about two hours to run on an average machine.\n\n```\npython3 setup.py test\n```\n\n## Recover Scrabble Game\nRecover the moves of a Scrabble game given only the \nfinal board and the list of player scores for each move.\n\nUsage:\n```shell\n$ recover_scrabble_game [INPUT_FILENAME]\n```\n\nSee [scrabble/tests/sample_input_files](scrabble/tests/sample_input_files)\nfor examples of correctly formatted input files\n\nExample:\n```\n$ recover_scrabble_game ./tests/sample_input_files/sample_input30.json\n\n[\n    [\n        [(('h', 8), '*OWDY')],\n        [(('e', 10), 'R(A)ZE')],\n        [(('h', 12), '(Y)IP')],\n        [(('b', 13), 'MOV(E)')],\n        [(('c', 6), 'GU(Y)')],\n        [(('l', 10), '(D)OTE')],\n        [(('e', 3), '(G)UILE')],\n        [(('i', 2), 'B(E)ER')],\n        [(('i', 5), '(R)IP')],\n        [(('g', 2), 'H(I)NT')],\n        [(('l', 2), '(D)UNE')],\n        [(('j', 12), '(PI)TA')],\n        [(('h', 9), '(O)R*')],\n        [(('o', 13), 'LI(T)')],\n        [(('e', 15), 'BANAN(A)')]\n    ], [\n        [(('d', 11), 'FAME(D)')],\n        [(('d', 8), 'CRIE(*)')],\n        [\n            (('i', 12), '(I)T'),\n            (('j', 12), '(P)I'),\n            (('i', 13), 'TIGHT')\n        ],\n        [(('e', 3), 'GRAYE(R)')],\n        [(('l', 10), 'DAS(H)')],\n        [(('o', 8), 'OV(E)N')],\n        [(('c', 4), 'JA(R)')],\n        [(('c', 4), '(J)I(G)')],\n        [(('b', 10), 'LOO(M)S')],\n        [\n            (('l', 2), 'DOWEL'),\n            (('i', 5), '(RIP)E')\n        ],\n        [(('o', 1), 'R(E)ASON')],\n        [(('m', 13), '(T)AX')],\n        [(('l', 15), 'E(X)IT')],\n        [\n            (('a', 14), 'I(S)'),\n            (('a', 14), 'ID')\n        ],\n        [(('j', 7), 'SE(*)K')]\n    ]\n]\n```\n\n## Play Scrabble Game\n### Create a new Scrabble game object\n\n* __scrabble.main.ScrabbleGame(__*num_players*__)__\n\n```\n\u003e\u003e\u003e from scrabble.main import ScrabbleGame\n\u003e\u003e\u003e game = ScrabbleGame(num_players=4)\n\u003e\u003e\u003e game\n  abcdefghijklmno\n1 _______________\n2 _______________\n3 _______________\n4 _______________\n5 _______________\n6 _______________\n7 _______________\n8 _______★_______\n9 _______________\n10_______________\n11_______________\n12_______________\n13_______________\n14_______________\n15_______________\n[[G, T, E, A, D, P, C], [E, I, S, O, N, G, M], [M, S, T, U, R, O, J], [E, *, L, A, R, I, A]]\nMoves played: 0\nPlayer 1's move\n72 tiles remain in bag\nPlayer 1: 0\nPlayer 2: 0\nPlayer 3: 0\nPlayer 4: 0\n```\n\n### Make Move\n* __scrabble.main.ScrabbleGame.place\\_word(__*word, start_location, is_vertical_move*__)__\n\nPlace a word from the rack of the next player onto the board.  If the\nmove is legal you will be prompted as to whether or not the move was\nsuccessfully challenged.  If the move goes through through then the method will\nreturn `True`.  If the move is illegal you will not receive a challenge prompt\nand the method will return `False`.\n```\n\u003e\u003e\u003e game.place_word(word='GATE', start_location=('h', 8), is_vertical_move=False)\nChallenge successful (Y/N)N\nTrue\n\n\u003e\u003e\u003e game\n  abcdefghijklmno\n1 _______________\n2 _______________\n3 _______________\n4 _______________\n5 _______________\n6 _______________\n7 _______________\n8 _______GATE____\n9 _______________\n10_______________\n11_______________\n12_______________\n13_______________\n14_______________\n15_______________\n[[D, P, C, O, E, F, N], [E, I, S, O, N, G, M], [M, S, T, U, R, O, J], [E, *, L, A, R, I, A]]\nMoves played: 1\nPlayer 2's move\n68 tiles remain in bag\nPlayer 1: 10\nPlayer 2: 0\nPlayer 3: 0\nPlayer 4: 0\n```\n\n### Find Best Move (Brute Force)\n* **scrabble.main.ScrabbleGame.get_best_move()**\n\nFind the best move via brute-force search.  Returns the move score and move\ntuple of the form *(location, word, is_vertical_move)*.\n```\n\u003e\u003e\u003e game.get_best_move()\n\n(27, (('l', 4), 'EGOISM', True))\n```\n\n### Exchange Tiles\n* __scrabble.main.ScrabbleGame.exchange(__*letter_list*__)__\n\nExchange up to all a player's rack tiles as long as the bag has at least\none entire rack of tiles remaining.\n```\n\u003e\u003e\u003e game.exchange(letter_list=['E', 'I', 'S', 'O'])\nTrue\n\n\u003e\u003e\u003e game\n  abcdefghijklmno\n1 _______________\n2 _______________\n3 _______________\n4 _______________\n5 _______________\n6 _______________\n7 _______________\n8 _______GATE____\n9 _______________\n10_______________\n11_______________\n12_______________\n13_______________\n14_______________\n15_______________\n[[D, P, C, O, E, F, N], [A, P, R, M, N, G, M], [M, S, T, U, R, O, J], [E, *, L, A, R, I, A]]\nMoves played: 1\nPlayer 3's move\n68 tiles remain in bag\nPlayer 1: 10\nPlayer 2: 0\nPlayer 3: 0\nPlayer 4: 0\n```\n\n### Conclude Game\n* __scrabble.main.ScrabbleGame.conclude\\_game(__*empty_rack_id=None*__)__\n\nCalculates final scores and declares a winner.  This method will automatically\nbe called and bonuses automatically awarded if one player has an empty rack\n(plays out) when the tile bag is empty.\n```\n\u003e\u003e\u003e game.conclude_game()\nGame Over! Player 1 wins with a score of 10\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjamincrom%2Fscrabble","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenjamincrom%2Fscrabble","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjamincrom%2Fscrabble/lists"}