10-Second Scrabble: Scrabble, but in 10-seconds and not as fun

Hey everyone!
For this portfolio project, I decided to make a single-player Python terminal game of Scrabble. The point of the program is for the player to type as many words as possible within ten seconds, and only with the 7 letters that the program randomly picks.
I tried to make this program to be as clean and bug-free as possible, but I wouldn’t be the least bit surprised if I made some oversights in my code. I would be grateful if any of my peers could point out the flaws in this game.


The github link is: danielm799/10-Second-Scrabble-Game (github.com)

Hello!

Interesting variation of the game!

Recommendations and thoughts:

  1. Reorganize your code. Put your code in that sequence: imports, function definitions, main code. With this structure it will be easier to read. Currently you have variables initialization and player name input (lines 9-17) between imports and functions.
  2. Use function scramble_list for initial letters generation too (instead of lines 15-17).
  3. For limited user input like yes and no use lower/upper (Built-in Types — Python 3.10.1 documentation) methods before compare, so you can ignore source string case. See also strip (Built-in Types — Python 3.10.1 documentation).
  4. About timer. In your code timer is not background in the full sense. Real background timer will end the game even without user input. In source StackOverflow post used a OS signals, this is advanced topic.
  5. Because your project have dependency (GitHub - mwiens91/english-words-py: Sets of English words to use in Python scripts/programs), you can put this in requirements.txt file to easy install by users. Official documentation is very verbose (Requirements File Format - pip documentation v21.3.1) but in result you need to add single line english-words==1.0.4 in your requirements.txt. Users can install dependencies by running pip -r requirements.txt.

Nice work!

PS Sorry for my English)

2 Likes

Hello!
1 and 2. First off, thank you so much for your feedback. I knew my code was a little ugly, but I couldn’t figure out why. I had no idea it would be a matter of organization. The same goes for finding a better use of my scramble_list function.
3. I was thinking of using the lower method. I don’t know why I didn’t go through with it. That was silly of me
4. I honestly didn’t think I would need to use OS signals because I was under the impression that it would only produce a message. That was another silly oversight on my part
5. I was wondering on how to properly credit the creator of the library beyond simply linking their github page. I never knew it was common practice to add a txt file to list the requirements for the program. I hope that would be the last of my mistakes. I’ll be sure to add that to the repository.

PS Your English is just fine! I understood everything you said :slight_smile:

1 Like

Hello!

All that I pointed before are not errors or silly decisions. This is only recommendations and best practices.

For example usage of OS signals is not neccessary in that project. I only clarified your comment in the code for you to better understanding what is real background timer.

Expirience comes with more code, remember that)

Good luck!

1 Like