Skip to content

Commit

Permalink
First pass content!
Browse files Browse the repository at this point in the history
  • Loading branch information
jbieniosek committed Aug 31, 2021
1 parent dfc71bd commit 7463782
Show file tree
Hide file tree
Showing 12 changed files with 207 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.vscode/
.DS_Store

# GitHub's boilerplate Python gitignore
# https://github.com/github/gitignore/blob/master/Python.gitignore

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand All @@ -20,7 +26,6 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
Expand Down Expand Up @@ -50,6 +55,7 @@ coverage.xml
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
Expand All @@ -72,6 +78,7 @@ instance/
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
Expand All @@ -82,7 +89,9 @@ profile_default/
ipython_config.py

# pyenv
.python-version
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand Down Expand Up @@ -127,3 +136,9 @@ dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
35 changes: 35 additions & 0 deletions Dockerfile
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
11 changes: 11 additions & 0 deletions adagrams/game.py
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
30 changes: 30 additions & 0 deletions adagrams/ui_helper.py
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.")
105 changes: 105 additions & 0 deletions main.py
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)
8 changes: 8 additions & 0 deletions requirements.txt
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
1 change: 1 addition & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest
Empty file added tests/__init__.py
Empty file.
Empty file added tests/test_wave_01.py
Empty file.
Empty file added tests/test_wave_02.py
Empty file.
Empty file added tests/test_wave_03.py
Empty file.
Empty file added tests/test_wave_04.py
Empty file.

0 comments on commit 7463782

Please sign in to comment.