Skip to content
Open
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ $ cd ~/Developer/projects
$ git clone ...
```

Use `ls` to confirm there's a new project folder

Use `ls` to confil
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is why it's good to git diff before you commit things. :-P

5. Move your location into this project folder

```bash
Expand Down Expand Up @@ -198,7 +197,7 @@ We recommend spending at least a portion of the time pair programming and workin

Take time to read through the Wave 1 implementation requirements and the tests for wave 1. Write down your questions, and spend some time going through your understanding of the requirements and tests with your pair. Make sure you both can run `$ pytest` and see the tests fail.

If, after you and your pair have taken some time to think through the problem and would like direction for how to dissect the problem, or if you need clarity on the terms/vocabulary we used in this project, you can check out [a small hint we've provided](./project_docs/hints.md).
If, after you and your pair have taken some time to think through the problem and would like direction for how to dissect the problem, or if you need clarity on the terms/vocabulary we used in this project, you can check out [a small hinupt we've provided](./project_docs/hints.md).

### Wave 1: draw_letters

Expand Down
130 changes: 126 additions & 4 deletions adagrams/game.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,133 @@

import copy

LETTER_VALUE = {
'A': 1,
'B': 3,
'C': 3,
'D': 2,
'E': 1,
'F': 4,
'G': 2,
'H': 4,
'I': 1,
'J': 8,
'K': 5,
'L': 1,
'M': 3,
'N': 1,
'O': 1,
'P': 3,
'Q': 10,
'R': 1,
'S': 1,
'T': 1,
'U': 1,
'V': 4,
'W': 4,
'X': 8,
'Y': 4,
'Z': 10
}

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
}


def draw_letters():
pass

import random

letters = []
letter_pool_lst = []
tup = ""

for letter, frequency in LETTER_POOL.items():
tup = tuple(letter*frequency)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Style: spacing

Suggested change
tup = tuple(letter*frequency)
tup = tuple(letter * frequency)


for letter_frequency in tup:
for letter in letter_frequency:
letter_pool_lst.append(letter)

letters = random.sample(letter_pool_lst, 10)
return letters


def uses_available_letters(word, letter_bank):
pass
compare_letters = copy.deepcopy(letter_bank)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice use of deepcopy. 😃

for ltr_word in word:
if ltr_word not in compare_letters:
return False
else:
compare_letters.remove(ltr_word)
return True


def score_word(word):
pass
score_list = []
bonus = 8
if word == "":
return 0
else:
for letter in word:
score_list.append(LETTER_VALUE[letter.upper()])
if len(score_list) >= 7:
score = (sum(score_list) + bonus)
else:
score = sum(score_list)
return score
Comment on lines +95 to +104
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can simplify this by reordering things a little:

Suggested change
if word == "":
return 0
else:
for letter in word:
score_list.append(LETTER_VALUE[letter.upper()])
if len(score_list) >= 7:
score = (sum(score_list) + bonus)
else:
score = sum(score_list)
return score
score = 0
for letter in word:
score_list.append(LETTER_VALUE[letter.upper()])
if len(score_list) >= 7:
score = (sum(score_list) + bonus)
else:
score = sum(score_list)
return score

(This works because if the loop never runs score stays at 0.)



def get_highest_word_score(word_list):
pass
word_score_dict = {}

for word in word_list:
word_score = score_word(word)
word_score_dict[word] = word_score


highest_score = 0
highest_score_word = ""
hst_score_and_word = ""
Comment on lines +116 to +117
Copy link
Collaborator

Choose a reason for hiding this comment

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

I recommend initializing placeholders like this to None for clarity:

Suggested change
highest_score_word = ""
hst_score_and_word = ""
highest_score_word = None
hst_score_and_word = None



for word_name, word_score in word_score_dict.items():
if word_score > highest_score:
highest_score_word = word_name
highest_score = word_score

if word_score == highest_score and len(word_name) != len(highest_score_word):
if len(word_name) == 10:
highest_score_word = word_name
elif len(word_name) < len(highest_score_word) and len(highest_score_word) != 10:
highest_score_word = word_name
highest_score = word_score

hst_score_and_word= (highest_score_word, highest_score)
return hst_score_and_word
142 changes: 142 additions & 0 deletions sandbox.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
## WAVE 1

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
}


def draw_letters():

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
}
letters=[]
letter_pool_lst=[]
tup=""

for letter, numby in LETTER_POOL.items():
tup= tuple(letter*numby)

for t in tup:
for x in t:
letter_pool_lst.append(x)

letters = random.sample(letter_pool_lst, 10)

print(letters)
return letters

#draws_ten
#is_list_of_letter_strings
#letter_not_selected_too_many_times
pass


## WAVE 2

def uses_available_letters(word, letters):
# true_word_in_letter_bank
# false_word_in_letter_bank
# false_word_overuses_letter
# does_not_change_letter_bank
def uses_available_letters(word, letters):
# compare_letters = []
# for letter in letters:
# compare_letters.append(letter)
compare_letters = copy.deepcopy(letters)
for ltr_word in word:
print(ltr_word)
#for ltr_letters in letters:
if ltr_word not in compare_letters:
return False
else:
compare_letters.remove(ltr_word)
return True
pass


## WAVE 3

def test_score(score_word):
score_list = []
score = sum(score_list)
if score_word == "":
return 0
else:
for letter in score_word:
score_list.append(LETTER_POOL[letter.upper()])
#if len(score_word) >= 7:
#

# word_accurate
# word_accurate_ignores_case
# zero_for_empty
# extra_points_for_seven_or_longer




## WAVE 4

def get_highest_word_score(words):
# accurate
# accurate_unsorted_list
# tie_prefers_shorter_word
# tie_prefers_shorter_word_unsorted_list
# tie_prefers_ten_letters
# tie_same_length_prefers_first
pass