forked from Ada-C16/adagrams-py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dfc71bd
commit 7463782
Showing
12 changed files
with
207 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Install latest version of node | ||
FROM continuumio/anaconda3:latest | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
build-essential \ | ||
ca-certificates \ | ||
curl \ | ||
sudo \ | ||
openssl \ | ||
libssl-dev libffi-dev \ | ||
--no-install-recommends | ||
|
||
# Create directory for app | ||
RUN mkdir /app | ||
|
||
# Set as current directory for RUN, ADD, COPY commands | ||
WORKDIR /app | ||
|
||
# Add to PATH | ||
ENV PATH /app:$PATH | ||
|
||
# Add requirements.txt from upstream | ||
ADD requirements.txt /app | ||
RUN pip install -r /app/requirements.txt | ||
|
||
# Add entire student fork (overwrites previously added package.json) | ||
ARG SUBMISSION_SUBFOLDER | ||
ADD $SUBMISSION_SUBFOLDER /app | ||
|
||
# Overwrite files in student fork with upstream files | ||
ADD test.sh /app | ||
ADD tests /app/tests | ||
|
||
# User defined requirements | ||
# RUN make init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
def draw_letters(): | ||
pass | ||
|
||
def uses_available_letters(word, letter_bank): | ||
pass | ||
|
||
def score_word(word): | ||
pass | ||
|
||
def get_highest_word_score(): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
def display_welcome_message(): | ||
print("Welcome to Adagrams!") | ||
|
||
def display_drawn_letters(letters): | ||
print("You have drawn the letters:") | ||
print(', '.join(letters)) | ||
|
||
def display_game_instructions(): | ||
print("Please input your submission for the longest anagram you can come up with") | ||
|
||
def display_needs_valid_input_message(): | ||
print("You entered in a word that contains characters not in the letter bank") | ||
display_game_instructions() | ||
|
||
def display_score(score): | ||
print(f"Your submitted anagram scored {score} points") | ||
|
||
def display_retry_instructions(): | ||
print("Should we play another round?") | ||
print("Enter y to replay") | ||
|
||
|
||
def display_goodbye_message(): | ||
print("Goodbye!") | ||
|
||
# word_score must be a data structure such as a list or tuple where the first element | ||
# is the word and the second element is the score. | ||
def display_highest_score(word_score): | ||
print("Thanks for playing Adagrams!") | ||
print(f"The highest score from this game was {word_score[0]}, which was worth {word_score[1]} points.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import sys | ||
from adagrams.ui_helper import * | ||
from adagrams.game import draw_letters, uses_available_letters, score_word, get_highest_word_score | ||
|
||
def wave_1_run_game(): | ||
display_welcome_message() | ||
game_continue = True | ||
while game_continue: | ||
print("Let's draw 10 letters from the letter pool...") | ||
letter_bank = draw_letters() | ||
display_drawn_letters(letter_bank) | ||
display_game_instructions() | ||
|
||
display_retry_instructions() | ||
continue_input = input() | ||
game_continue = continue_input == "y" | ||
|
||
display_goodbye_message() | ||
|
||
def wave_2_run_game(): | ||
display_welcome_message() | ||
game_continue = True | ||
while game_continue: | ||
print("Let's draw 10 letters from the letter pool...") | ||
letter_bank = draw_letters() | ||
display_drawn_letters(letter_bank) | ||
display_game_instructions() | ||
user_input_word = input() | ||
|
||
while( not uses_available_letters(user_input_word, letter_bank)): | ||
display_needs_valid_input_message() | ||
user_input_word = input() | ||
|
||
display_retry_instructions() | ||
continue_input = input() | ||
game_continue = continue_input == "y" | ||
|
||
display_goodbye_message() | ||
|
||
def wave_3_run_game(): | ||
display_welcome_message() | ||
game_continue = True | ||
while game_continue: | ||
print("Let's draw 10 letters from the letter pool...") | ||
letter_bank = draw_letters() | ||
display_drawn_letters(letter_bank) | ||
display_game_instructions() | ||
user_input_word = input() | ||
|
||
while( not uses_available_letters(user_input_word, letter_bank)): | ||
display_needs_valid_input_message() | ||
user_input_word = input() | ||
|
||
score = score_word(user_input_word) | ||
display_score(score) | ||
|
||
display_retry_instructions() | ||
continue_input = input() | ||
game_continue = continue_input == "y" | ||
display_goodbye_message() | ||
|
||
def wave_4_run_game(): | ||
display_welcome_message() | ||
game_continue = True | ||
played_words = [] | ||
while game_continue: | ||
print("Let's draw 10 letters from the letter pool...") | ||
letter_bank = draw_letters() | ||
display_drawn_letters(letter_bank) | ||
display_game_instructions() | ||
user_input_word = input() | ||
|
||
while( not uses_available_letters(user_input_word, letter_bank)): | ||
display_needs_valid_input_message() | ||
user_input_word = input() | ||
|
||
score = score_word(user_input_word) | ||
display_score(score) | ||
played_words.append(user_input_word) | ||
|
||
display_retry_instructions() | ||
continue_input = input() | ||
game_continue = continue_input == "y" | ||
display_highest_score(get_highest_word_score(played_words)) | ||
display_goodbye_message() | ||
|
||
def main(wave): | ||
if(wave == 1): | ||
wave_1_run_game() | ||
elif(wave == 2): | ||
wave_2_run_game() | ||
elif(wave == 3): | ||
wave_3_run_game() | ||
elif(wave == 4): | ||
wave_4_run_game() | ||
else: | ||
print("Please input a wave number. Valid wave numbers are 1, 2, 3, 4.") | ||
|
||
if __name__ == "__main__": | ||
args = sys.argv | ||
if(len(args) >= 2 and args[1].isnumeric()): | ||
wave = int(args[1]) | ||
else: | ||
wave = "ERROR" | ||
main(wave) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
attrs==20.3.0 | ||
iniconfig==1.1.1 | ||
packaging==20.8 | ||
pluggy==0.13.1 | ||
py==1.10.0 | ||
pyparsing==2.4.7 | ||
pytest==6.2.1 | ||
toml==0.10.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pytest |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.