Scrabble ScorePAD is an application designed to help validate and score words during a game of Scrabble.
The following user stories were created to aid the development of this application:
- As a casual Scrabble player, I want to check words I'm playing so I know they are valid
- As casual player, I want an easy way to calculate my word score quickly so I can get on with playing the game and avoid making mistakes when scoring
- As an average player, I want an easy way to score each word I play and keep overall track of my score
- As a more seasoned player, I want the option to score only words on Scrabble's tournament list (TWL06) so I can ready myself for official competition
Drawing on the above user stories, the main aims of the application are as follows:
- To provide a helpful and intuitive app for scoring Scrabble which runs in a basic python terminal inside a browser window
- To allow the user to choose between Scrabble's two official wordlists (SWOPODS and TWL06)
- To allow the user to ensure that a word played is valid for the particular Scrabble wordlist they are using
- To allow the user to easily indicate blank tiles, double/triple letter/word scores and 'bingo' bonuses as they score each word
- To keep track of all words played and provide a running total of their scores
With these aims in mind, the following flowchart was drawn up as blueprint for writing the program, breaking down the various stages of input, decision, logic and function. The diagram was created using the chart design site Lucid
As development of the program progressed various new checks and functions were added into what is shown above, but this diagram provided a good starting point for the initial writing of the code.
- When presented with a list of options simply type the relevant number and hint 'Enter' on the keyboard
- Firstly, one of two initial official Scrabble lists must be selected, then the user can enter the first word for scoring
- The word to be checked should be entered along with any indication of blank tiles used and/or double/triple letter scores:
- Use '*' after a letter to indicate the tile is blank
- Use '2' after a letter to indicate a double letter score
- Use '3' after a letter to indicate a triple letter score
- If a blank tile and double/triple letter score appear together simply use '*'
- The input will be checked to ensure it is valid and that the word appears on the previously selected wordlist
- The user will then be offered the opportunity to indicate a double/triple word score and 'bingo' (all tiles used) bonus, if applicable
- Once all scoring types have been indicated, the final score and breakdown is presented to the user
- The user is then presented with the option of scoring another word, changing the wordlist, showing a full list of words scored or closing the program
- The program will run and continue to score words/keep score until the user chooses to close the program
Tab, Title & Background
- A favicon is included as part of the tab styling, taking the form of an 'S' tile found in Scrabble.
- The title is placed at the top of the page above the terminal to clearly indicate the program in use.
- Clicking the title will not refresh/redirect the page as this would interrupt the program.
- No navigation bar is provided as this site has a one-page focus; interaction occurs through means of the terminal.
- A background image of a Scrabble board emphasises the theme of the program and helps with eye strain , preventing a dark terminal on a white background
Terminal Formatting
- Text within the terminal has been coloured using the Colorama library to help with readability and information perception:
- Cyan is used for main headings such as the welcome/closing messages.
- Yellow is used for menu headings and their options.
- Green is used for those times user input is required.
- Red is used for error messages.
- White is used for all other pieces of informational text.
'Run Program' Button
- A button is placed below the terminal as a means of restarting the program after it ends or as desired.
- The button is styled with hover elements to provide feedback to the user.
Wordlist Selection
- The user has the option of selecting one of two official Scrabble wordlists
- This allows casual/tournament players and those from different regions to make use of the program
- Any invalid data entry is noted by the program and notice is given to the user
Word & Modifier Input
- After selecting the relevant wordlist, the word to be checked/scored is entered
- At this point the user also indicates blank tiles and/or double/triple letter scores
- Asking for input of letters and modifiers together keeps data-string entry to a minimum
- Any invalid data entry is noted by the program and notice is given to the user
- Specifically, the following errors will be caught and require correction before proceeding:
- Data entry less than two characters long (no one-letter words exist on Scrabble lists)
- Data entry that contains invalid characters (only letters and *,2,3 permitted)
- More than one modifier indicated beside a letter (blank takes precedence over double/triple)
- Data entry that begins with a modifier (modifiers are to be placed after letters)
- Valid inputs have their letter values taken from an in-built dictionary and are ignored/doubled/tripled where appropriate
Word Validation
- Any modifiers entered in the previous step are omitted by the program so the word can be read correctly
- The program checks to see if the word entered appears on the previously selected wordlist
- If an invalid word is entered the user is notified and the end program menu is presented
- A valid word causes the program to proceed to the final checks before scoring
Multiplier menu
- If a valid word is entered, options for double/triple word scores are presented
- Certain options will only appear depending on word length given the layout of an official Scrabble board
- Words < 7 letters can only have a single double/triple word score
- Words of 7+ letters also have a double x2 option
- Words of 8+ letters also have a triple x2 option
- Words of 15 letters have a triple x3 option
- Any double/triple score selected is applied to the base value of the word from the previous step
- Any invalid data entry is noted by the program and notice is given to the user
Bonus Menu
- If a word is 7+ letters the option to include a bonus score is presented
- If this option is confirmed as 'Yes', 50 points are added to the word score
- Any invalid data entry is noted by the program and notice is given to the user
Word Score
- After all of these steps have been completed the final word score is displayed
- This screen gives a letter score, multiplied score, bonus score and final total
- The word scored is also presented alongside the original string that was entered by the user
- This breakdown allows the user to see exactly how they have scored the total given
End Of Program Menu
- Immediately after the score is shown, various options appear on screen to benefit the user experience
- The user can immediately score a new word without the need to change wordlist
- The user can change wordlist before scoring again
- The user can view all words scored so far, including their individual scores and total
- The user can safely exit the program when finished
- This allows the program to be used in a continuous manner without the need to reset the terminal
- Any invalid selection is noted by the program and notice is given to the user
Total Score Screen
- Selecting the third option from above displays a full list of scored words
- Each entry also shows the entered string, multiplier/bonus scores and individual score for each word
- A total score for all words entered is also displayed allowing the program to be used a scoring tool in a real game of Scrabble
- Immediately following this, the previous options are displayed to the user once again
- Any invalid selection at this point is noted by the program and notice is given to the user
The following tests have been run on each part of the program to ensure that it is operating as expected:
Initial Startup
Feature | Test | Input(s) | Expected | Result | Display | Pass/Fail |
---|---|---|---|---|---|---|
Welcome Message | Run program | n/a | Welcome message showing program is running | Welcome message displayed as expected | ![]() |
Pass |
Wordlist Selection
Word & Modifier Input
Double/Triple Score Indication
Bonus Score Indication
Final Word Score Breakdown
End Menu Selection
- PEP8: No errors were returned when passing the program through the PEP8 Validator
- The
string_validator()
function was running into problems with regard to some very particular string inputs which while unlikely to be entered by the user were very much possible and could crash the program. This was resolved by ensuring that the error checking is performed in a very particular order and will not proceed to the next stage of an error is found. - The
word_validator()
function was running into an error after running for a second time i.e. when the user tried to score a second word, specifically with the name of the particular.txt
file not being carried over correctly from one iteration to the next. This was resolved by storing only the name of the particular file as a variable (wordlist_file
) and not the entire filepath each time. - The function
evaluate_letters()
was not calculating the word score correctly, choosing to leave off the final letter each time if was not followed by a modifiers. This was resolved by adding a 'dummy' character of!
at the start of the function.
- No operational/exceptional bugs are known at this time.
A live link to the site can be found here: https://scrabble-scorepad.herokuapp.com
This site was deployed to Heroku as an app. Steps for deployment are as follows (NB to do this yourself, you will first need to fork the GitHub repository as outlined below):
- In Heroku, create a new app with a unique name of your choice
- When prompted or under settings, set the buildpacks to Python and Node JS, in that order
- Under the same tab, create a Config Var with Key: 'PORT' and Value: '8000'
- Link the Heroku app to the repository and click on Deploy
Forking the repository allows for a copy to be made without affecting the original. Steps for forking are as follows:
- Log in to GitHub (requires an account) and locate the GitHub Repository for Scrabble ScorePAD
- Locate and click the 'Fork' button near the very top right of the repository page.
- This will create a copy of the original Scrabble ScorePAD repository in your own GitHub account.
- Overview image created using Am I Responsive?
- Flowchart designed using Lucid Charts
- Favicon created with favicon.io
- Background image attributed to 'Barrow Boy' used under Creative Commons licence via Wikipedia Commons
- Terminal colours added using Colorama
- README.md file adapted from the Code Institute 'ULTIMATE Battleships' example