How to use the 'Scrabble Helper' Python script
Are you a Scrabble enthusiast looking to take your game to the next level? Look no further than the "Scrabble Helper" Python script! This script is designed to help you find the best words to play in Scrabble, based on the tiles you have available.
Prerequisties :
To use the "Scrabble Helper" Python script, there are a few prerequisites you'll need to meet. First and foremost, you'll need to have Python 3 installed on your computer. If you don't already have it installed, you can download it for free from the official Python website.
In addition to Python 3, you'll also need a text file named "words.txt" that contains a list of all valid Scrabble words from 2 to 7 letters long, separated by spaces. You can create this file yourself, or download one from a reputable source online.
Once you have Python 3 and your "words.txt" file set up, you're ready to run the "Scrabble Helper" Python script. To do this, simply open a command prompt or terminal window and navigate to the directory where your script is saved. Then, type "python scrabble_helper.py" and hit enter.
The script will prompt you to enter your seven Scrabble tiles, which you should enter as capital letters. Once you've entered your tiles, the script will analyze the list of valid Scrabble words from "words.txt" and output a categorized list of all the words you can make with your tiles, sorted by word length.
For example:
Enter your 7 letters: AEIOTVY
Words of 2 letters: []
Words of 3 letters: ['ivy', 'tie', 'toe', 'toy', 'vet', 'vie', 'yet']
Words of 4 letters: ['vote']
Words of 5 letters: ['evict', 'ovate', 'toe-y']
Words of 6 letters: []
Words of 7 letters: ['ovatine']
As you can see, the script outputs a list of words for each word length from 2 to 7 letters, along with the letters that make up each word.
If you want to perform another action, such as entering a new set of tiles or running the script again with different options, the script will prompt you to do so. Simply follow the prompts and the script will guide you through the process.
Conclusion :
In conclusion, the "Scrabble Helper" Python script is a powerful tool for any Scrabble player looking to improve their game. With just a few simple steps, you can use the script to find the best words to play and gain an edge over your opponents. So why not give it a try today and see how it can help you dominate the Scrabble board!
Leave a comment if you have any questions.
If you enjoy my blog posts, you can support me by a tip in my wallet.
Thanks for you support
BTC : bc1qvfmetg2d36mmntrg56ld0tdrte8cqeygjxdpsg
ETH | USDC | USDT : 0x02AbfBf22fA72d068Ff305e58dF782e58F863274
DOGE : DLtGbPrFvwW5y7jFuvuDAkZGNB2eAErAxA
See you soon !
Casper_X 👻
Here is the script :
def categorize_words(words, letters):
categorized_words = {i: [] for i in range(2, 8)}
for word in words:
length = len(word)
if length >= 2 and length <= 7:
word_is_valid = True
for letter in word:
if word.count(letter) > letters.count(letter):
word_is_valid = False
break
if word_is_valid:
categorized_words[length].append(word)
return categorized_words
def main():
# Add a 'words.txt' file with a list of all words from 2 to 7 letters separated by 1 space
with open("words.txt") as f:
lines = f.readlines()
words = []
for line in lines:
line_worlds = line.strip().split(" ")
words += line_worlds
letters = input("Enter your 7 letters : ")
letters = letters.upper()
categorized_words = categorize_words(words, letters)
for length, word_list in categorized_words.items():
print(f"Word of {length} letters : {word_list}")
def another_action():
while True:
choice = input("Do you want to perform another action ? (y/n) : ")
if choice == 'y':
return True
elif choice == 'n':
print("\nSee you soon !")
return False
else:
print("Error : Invalid choice. Please enter 'y' for yes and 'n' for no.")
if __name__ == "__main__":
play_again = True
while play_again:
main()
play_again = another_action()