-
Notifications
You must be signed in to change notification settings - Fork 57
Cedar - Citlalli Z #31
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
base: master
Are you sure you want to change the base?
Changes from all commits
5e89fbb
ea217a6
8fc0a83
c01a264
b881dd0
a844baa
9d5413b
83b4faa
246680d
969af76
cfddbc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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) | ||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style: spacing
Suggested change
|
||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
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) | ||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice use of |
||||||||||||||||||||||||||||||||||||||||
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can simplify this by reordering things a little:
Suggested change
(This works because if the loop never runs |
||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I recommend initializing placeholders like this to
Suggested change
|
||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
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 |
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 | ||
|
||
|
||
|
There was a problem hiding this comment.
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