Package: quarrel-solver
quarrel-solverTool forQuarrel(and other word games)SummaryProvides word game-related tools, and can be configured with custom settings, letter scores, and wordlists.Works on Python 3.6 and above. Tested on Windows 10.ContentsSummaryContentsThequarrel-solverlibraryDirect executionExample caseSettingsThequarrel-solverlibraryInstall thequarrel-solverlibrary to use all functionality in your own projects.Remember to always use the latest version, as not all bugfixes are documented!$py-mpipinstall--upgradequarrel-solver
$py>>>fromquarrel_solverimportbuild_settings,Ruleset>>>q=Ruleset(...settings=build_settings(...{'max_words_len':8}...)...)>>>print(...q.solve_str('wetodlnm')...)---query:delmnotw(8letters)---8letters-18pointsMELTDOWN5letters-14pointsMOWED4letters-12pointsMEWL3letters-10pointsMEW,MOW,WEM2letters-6pointsEW,OW,WE,WO>>>_Note: for thepip installcommand, you can usequarrel-solverwith a hyphen, orquarrel_solverwith an underscore. When importing the module in Python or running it from the commandline, youMUSTuse an underscore.For a more informed walkthrough, please see theexample casebelow.Direct execution$py-mquarrel_solverIf you call the library directly, you'll be greeted with a commandline program. Its input screen looks like this:>_Type your letters into the field, pressEnter, and wait for the program to calculate the best words. Once it's done, choose one from the list that corresponds with the number of letters you have available, or the next lowest. See the example below to find out why you might not need to use all of your spaces.Example caseHere's an example using the default program settings. Our situation is the following:We're playingQuarrel, and thus we get 8 letters.Our letters arewetodlnm.We have 7 spaces to use.After installing the library, we'll open a commandline and run the program.Since we know we don't need words longer than 8 letters, we can minimise loading time by configuring the program to only calculate for words of that length. We can do this by passing our desired settings as command arguments:$py-mquarrel_solver--max_words_len8Note: this has the same effect as creating asettings.jsonfile, then running the command from the same directory:// settings.json
{"max_words_len": 8}## from folder with settings.json$py-mquarrel_solverWhichever way the program is run, it will have to load a wordlist. Once it finishes loading, we can input our letters and pressEnter.>wetodlnm---query:delmnotw(8letters)---8letters-18pointsMELTDOWN5letters-14pointsMOWED4letters-12pointsMEWL3letters-10pointsMEW,MOW2letters-6pointsOW,WE,WO>_This tells us that the anagram isMELTDOWN, but we can't make that word because we can only use 7 letters. In this case, our best word isMOWED(14 points). Based on this output, we also know that our opponent cannot score higher than us without all 8 spaces.Note: a word likeLETDOWNscores the same number of points asMOWED, but isn't recognised as a "best word" in this case. This is because when words are tied for points, the program will choose the word/s with the fewest letters.The fewer letters your word has, the faster you can write it into your game. This is especially important inQuarrel, as the tiebreaker for equal points is input speed.SettingsUpon being run directly, the program will automatically generate (or look for) asettings.jsonfile in the directory which the command is run from. This file contains the program's settings, which can be changed to suit your needs.When usingquarrel-solver, you should can pass adictwith any of the following keys intobuild_settingsto generate a full settings object, then pass the output to aRulesetto create a new instance. Here are all the currently supported settings:SettingDefaultDescriptionall_lowercasefalseDisplays output in lowercase letters. The default setting displays capital letters to mimic the style of word games likeScrabbleandQuarrel. However, some people may find lowercase output more readable.allow_repeatsfalseDetermines whether letters can be used more than once. Change this according to your word game's rules; for example,Scrabbletiles can only be used once in a single word, whereasNew York Times'sSpelling Beeallows the reuse of letters.display_debugfalseShows the program's inner workings whilst calculating. Note that this may negatively affect performance on certain devices or IDEs.exclude_words[]List of words that the program will never output.ignore_scoresfalseDetermines whether point values for words are considered, in which case only the highest-scoring words are displayed. If you don't care about scoring, turn this off to see all words.include_words[]List of additional words for the wordlist.letter_scores"quarrel"Determines the letter scoring system used for calculating points. The value here is passed intobuild_letter_scores(), and defaults back if invalid.max_words_lenlongest length in wordlistDetermines the maximum word length the program will calculate for.min_words_len2Determines the minimum word length the program will calculate for.settings_path(commandline only)NonePath to the settings file.When running directly:To change your settings, do one of the following:Opensettings.jsonin a text editor and change any values. Make sure to save the file once you're done.Pass the setting as a command argument like this:--setting_name valueThis will automatically update the settings file, if applicable.$py-mquarrel_solver--display_debugtrue--max_words_len8Ifsettings.jsonis not present in your folder, try running the program and letting it fully load. It should then create the file.After savingsettings.json, the program will not change if it's already running. Close the program and run it again to use the changed settings.