Skip to content

Tigers: Sunny and Marie - Adagrams #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b577367
Adds time zones to README
mkeefer17 Sep 26, 2022
36d97b3
work on first function
mkeefer17 Sep 26, 2022
c884eb2
modified game.py file so we would stop getting a discovery error, aka…
sunnybysunny Sep 26, 2022
7c1ac3b
modified function draw_letters, tests 1 and 2 in Wave 01 are now passing
sunnybysunny Sep 26, 2022
b1576bd
modified function draw_letters now all tests in wave 01 pass
sunnybysunny Sep 26, 2022
0a9c620
added comments to explain code, and also added a body to the function…
sunnybysunny Sep 27, 2022
1d8376b
modified function uses_available_letters, test 4 in wave 02 now passes
sunnybysunny Sep 27, 2022
cfa0b9f
added an idea for uses_available_words function to solve for test 5 u…
sunnybysunny Sep 27, 2022
f8175e1
modified function uses_available_letters all tests in wave 02 pass
sunnybysunny Sep 27, 2022
3ad05d8
passes all tests in wave 3
mkeefer17 Sep 27, 2022
0289e4c
Merge branch 'master' of https://github.com/mkeefer17/adagrams-py
mkeefer17 Sep 27, 2022
398a454
created function get_highest_word_score tests 1,2,4,5,and 7 pass in w…
sunnybysunny Sep 28, 2022
3fea010
modified function get_highest_word_score, all tests in wave 04 pass, …
sunnybysunny Sep 29, 2022
08c9f4b
additional work on wave four
mkeefer17 Sep 29, 2022
4f72944
Merge branch 'master' of https://github.com/mkeefer17/adagrams-py
mkeefer17 Sep 29, 2022
b26ed6f
modified get highest_word_score function all tests in wave 04 pass
sunnybysunny Sep 29, 2022
902eb62
implemented suggestion for refactoring function draw letters
sunnybysunny Dec 3, 2022
4b1c0fe
implemented suggestion to refactor function uses available word
sunnybysunny Dec 3, 2022
ebca07d
implemented suggested syntax refactoring
sunnybysunny Dec 3, 2022
da21ee2
implemented suggestion to refactor function get highest word score th…
sunnybysunny Dec 3, 2022
6ebaf6a
finished implementing all suggestions for refactoring from pull reque…
sunnybysunny Dec 3, 2022
596a592
refactored draw ten letters to implement a for loop instead of a whil…
sunnybysunny Dec 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# AdaGrams
#-- Sunny: Mountain time. Marie: Eastern

## Skills Assessed

Expand Down
151 changes: 147 additions & 4 deletions adagrams/game.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,154 @@
import random
LETTER_POOL = {
'A': 9,
'B': 2,
'C': 2,
'D': 4,
'E': 12,
'F': 2,
'G': 3,
'H': 2,
'I': 9,
'J': 1,
'K': 1,
'L': 4,
'M': 2,
'N': 6,
'O': 8,
'P': 2,
'Q': 1,
'R': 6,
'S': 4,
'T': 6,
'U': 4,
'V': 2,
'W': 2,
'X': 1,
'Y': 2,
'Z': 1
}
SCORE_CHART = {
('A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T'): 1,
('D', 'G'): 2,
('B', 'C', 'M', 'P'): 3,
('F', 'H', 'V', 'W', 'Y'): 4,
('K'): 5,
('J', 'X'): 8,
('Q', 'Z'): 10
}

def draw_letters():
pass
letter_pool_list = []
my_ten_letters = []

for letter in LETTER_POOL:
for num in range(0,(LETTER_POOL[letter])):
letter_pool_list.append(letter)
Comment on lines +44 to +46

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea here! This will allow for a better distribution of probability when picking letters randomly.


#Claire's suggestion for a while loop


for i in range(10):
random_letter = random.choice(letter_pool_list)
my_ten_letters.append(random_letter)
letter_pool_list.remove(random_letter)
return my_ten_letters

#original solution

# while len(my_ten_letters) < 10:
# for num in range(0,10):
# random_letter = random.choice(letter_pool_list)
# my_ten_letters.append(random_letter)
# my_string_count = my_ten_letters.count(random_letter)
# word_pool_count = letter_pool_list.count(random_letter)
# if my_string_count > word_pool_count:
# my_ten_letters.remove(random_letter)

def uses_available_letters(word, letter_bank):
pass

word = word.upper()
# Claire's suggestion to combine the foor loops
for letter in word:
count_pool_letter = letter_bank.count(letter)
count_word_letter = word.count(letter)
if letter not in letter_bank:
return False
if count_word_letter > count_pool_letter:
return False
else:
continue
return True

# original for solution
# word = word.upper()
# letter_results = []
# for letter in word:
# if letter not in letter_bank:
# letter_results.append("f")
# if "f" in letter_results:
# return False
# else:
# return True

# for letter in word:
# count_pool_letter = letter_bank.count(letter)
# count_word_letter = word.count(letter)
# if count_word_letter > count_pool_letter:
# return False
# else:
# return True



def score_word(word):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

pass

if len(word) == 0:
return 0

word_score = 0
word = word.upper()

if len(word) in range(7, 11):
word_score += 8

for letter in word:
for key in SCORE_CHART:
if letter in key:
word_score += SCORE_CHART.get(key)
return word_score

def get_highest_word_score(word_list):
pass

score_dict = {}
for word in word_list:
score = score_word(word)
score_dict[word] = score

highest_score_value = max(score_dict.values())

highest_scores = []

#Claire's suggestion for more descriptive syntax
for word, score in score_dict.items():
if score == highest_score_value:
highest_scores.append([word,score])

# original solution
# for dict in score_dict.items():
# if dict[1] == highest_score_value:
# highest_scores.append(dict)

shortest_word_length = len(highest_scores[0][0])
shortest_word = highest_scores[0][0]

if len(highest_scores) > 1:
for word, score in highest_scores:
if len(word) >= 10:
shortest_word = word
return (shortest_word, highest_score_value)
elif len(word) < shortest_word_length:
shortest_word_length = len(word)
shortest_word = word
return (shortest_word, highest_score_value)