-
Notifications
You must be signed in to change notification settings - Fork 8
Project Submission #4
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
2c87b85
24678e7
a168e80
42abeb2
8730859
d959455
f4556da
dba8016
8976520
5118db2
2d2ea2d
c15d2ea
4933c21
e4c2e94
afea157
a786ea4
d0b42b6
96e4cd4
b133a20
03ad23a
459d704
f273cc2
31a7cdb
163590c
5b05cd1
30641b9
2c3120d
07ab946
bd1937a
e183459
47cb257
d216f76
cf87127
df10443
a870d23
3dac77b
2435bc3
e82a305
8155d51
231df00
90fad98
2efaecc
231e65f
a7ed21a
453689c
bc190ca
a8d39f8
59af4e5
7d216f1
6894572
4130462
5863d32
f63593d
8f2efc1
646e64c
8bfb444
6f88e50
62e75c2
4b50ce2
9dcf674
245d255
340cbe8
b96b29e
4549dc2
e773ac0
e6a9e17
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 |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Project Overview" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"We created game that allows people to build their own Olin portforlio whose advances depend on a series of Olin courses chosen by the user. \n", | ||
"This concept is inspired by the Grow Series games, specifically Grow Island (http://www.eyezmaze.com/grow/island/)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Results [~2-3 paragraphs + figures/examples]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Present what you accomplished. This will be different for each project, but screenshots are likely to be helpful" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Implementation [~2-3 paragraphs + UML diagram]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Describe your implementation at a system architecture level. Include a UML class diagram, and talk about the major components, algorithms, data structures and how they fit together. You should also discuss at least one design decision where you had to choose between multiple alternatives, and explain why you made the choice you did." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Reflection [~2 paragraphs]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Overall, working on this project was a great learning experience on how to build an interactive graphic with pygame and how code collaboratively. The project was divided into two parts: control algorithms and graphics. Each side of the project proved challenging and engaging to their owners. However, obvisouly, with three members in the team, the separation of the responsibilities was not as clear as it would have been with two member teams. The third member of our team often needed to complete sub-tasks for both algorithm and graphics, which presented challenges, such as Git merge errors and overload of code to examine. Our team has memebers from two different colleges, which resulted in different schedules and difficulty of meeting up in one setting. Despite these obstacles, our team still met more than four times in the span of two weeks, not including class time, and keep an active group chat to update each other on our progress.\n", | ||
"\n", | ||
"The most challanging part of the game development process was integration. Basically, both algorithms and and graphics had to meet each other halfway in a 'main' script to communicate to each other through passing of events and decisions. This time-consuming task forced all three members to teach each other the workings of their code. This process could have been optimized by creating a more in-depth model of our code prior to implementation. For the upcoming final project, some lessons we will all take with us is to emphasize initial code design, increase frequency of updates to team members, and clearly define individual tasks for each member." | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.6.1" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
# InteractiveProgramming | ||
# Interactive Programming | ||
|
||
This is the base repo for the interactive programming project for Software Design at Olin College. | ||
Software Design MP4 | ||
---- | ||
We created game that allows people to build their own Olin portfolio whose advances depend on a series of Olin courses chosen by the user. This concept is inspired by the Grow Series games, specifically Grow Island (http://www.eyezmaze.com/grow/island/). | ||
|
||
## Getting Started: | ||
First, install required package: pip install pygame | ||
|
||
## Usage | ||
To run the game, run main.py in the Source folder with python 3 | ||
|
||
## Links: | ||
[Project Reflection](https://docs.google.com/document/d/17OtSFGBJM4z2rdNP-eROhAGwgEVZCMOTp_JZXipS9jc/edit?ts=59f699c3#heading=h.dhufdrd1c1qm) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
label,course,description,max,dependencies,xrange | ||
mech,Mechanical Prototyping,Learn techniques for mechanical design... and how to not kill your teammates,5,3bees1 4focs3 4elec2 5mats1,841 | ||
bees,Sustainable Beekeeping,Beekeeping. Good for the environment. Ben Linder. Good for the soul.,3,2focs1 3mats2,51 | ||
focs,Fundamentals of Computer Science,Step one:FOCS. Step two:Offical Hacker d00d. Step 3:Rule the world.,3,3elec1,367 | ||
elec,Electricity and Magnetism,Does anyone know how electricity and magnetism work?,2,0,209 | ||
mats,Material Science,Material science. Explore materials. Self-explanatory...right?,2,0,683 | ||
robo,Fundamentals of Robotics,Death by Dave but in a project-based-learning way.,1,2mech5 2bees3 2focs3 2elec2 2mats2,525 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Author: Isa Blancett | ||
# Project: Interactive Programming | ||
# Date: 10.30.2017 | ||
# Description: Class for reading in a csv file containing course information and | ||
# creating and instance for each course | ||
# Acknowledgements: Script structure is modeled after Transcriptase's Game | ||
# repository on Git | ||
|
||
import csv | ||
|
||
class Courses(object): | ||
""" class for the different course options the user can choose from | ||
|
||
contains: | ||
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. Good job explaining what all of these are. An extra step you could do is specifically write what type these will end up being (ie: string, int, etc..). It's not necessary for this project, but it's good practice when you're making data structures like these. |
||
label - 4 letter id | ||
course - full title | ||
description - in-depth summary of course | ||
max - total number of levels | ||
reqs - dependencies, '%s%s%s' % (effected level, needed course, needed level) | ||
lvl - current level | ||
order - order picked by user | ||
""" | ||
|
||
def setup(self, config): | ||
|
||
self.config = config | ||
self.label = config['label'] | ||
self.name = config['course'] | ||
self.description = config['description'] | ||
self.max = config['max'] | ||
self.reqs = config['dependencies'] | ||
self.range = config['xrange'] | ||
self.lvl = 0 | ||
self.order = 0 | ||
|
||
|
||
|
||
def create_course(config): | ||
""" creates a single instance of a course given a config dictionary | ||
|
||
returns: single course instance | ||
""" | ||
|
||
new_course = Courses() | ||
new_course.setup(config) | ||
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. Consider changing The principles are:
This principles all come to the same thing here; I'm listing them as separate principles because they're all good design principles, and they don't always apply to the same situations. In this case, replacing |
||
return(new_course) | ||
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.
|
||
|
||
def populate(): | ||
""" sets up item objects by creating a config dictionary for each one | ||
|
||
Sample config dictionary (can be copied for each new item): | ||
config = { | ||
'label':'LABEL' | ||
'course':'COURSE TITLE', | ||
'description':'DESCRIPTION', | ||
'max': NUMBER OF LEVELS, | ||
'dependencies': 'LVL' + 'NEEDEDCOURSE' + 'NEEDEDLEVEL', | ||
'xrange': 'MIN MAX' | ||
} | ||
|
||
returns: dictionary of all course instances | ||
""" | ||
all_courses = {} | ||
|
||
f = open('Source/courses.csv', 'r') | ||
reader = csv.DictReader(f) | ||
|
||
for row in reader: | ||
if row != '0': | ||
row['dependencies'] = row['dependencies'].split() | ||
else: | ||
row['dependencies'] = [] | ||
new_course = (create_course(row)) | ||
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. outer parens aren't necessary |
||
all_courses[new_course.label] = new_course | ||
return all_courses |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Author: Siena Okuno | ||
# Project: Interactive Programming | ||
# Date: 10.30.2017 | ||
# Description: Determines endings | ||
|
||
import pygame | ||
import sys | ||
|
||
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 wonder if these functions could be put into the GamePlay class. They seem to be important parts of it. Rather than importing into the file, adding them to the class makes more sense |
||
def screenScroll(screen, color): | ||
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. The Python convention is |
||
'''Turns screen a color by filling in with rectangles.''' | ||
for i in range(700): | ||
pygame.draw.rect(screen, color, (0,i,1000,i+1)) | ||
i+=1 | ||
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. The |
||
pygame.display.flip() | ||
|
||
|
||
def ending(victory, levels, screen): | ||
'''Creates basic, text-only ending''' | ||
font50 = pygame.font.Font(None, 50) | ||
font20 = pygame.font.Font(None, 20) | ||
if victory == 0 or victory == 2: | ||
screenScroll(screen, (0,0,0)) | ||
screen.blit(font50.render("Looks like your portfolio", 1, (255,255,255)), (300, 250)) | ||
screen.blit(font50.render("could use some improvement", 1, (255,255,255)), (280, 350)) | ||
Done = False | ||
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. The convention for variables is lowercase. |
||
while not Done: | ||
for event in pygame.event.get(): | ||
if event.type == pygame.QUIT: | ||
Done = True | ||
for i in range(len(levels)): | ||
screen.blit(font20.render(levels[i], 1, (200,200,200)), (100, 450+i*25)) | ||
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 also use: for i, level in enumerate(levels):
screen.blit(font20.render(level, 1, (200,200,200)), (100, 450+i*25)) |
||
pygame.display.flip() | ||
if victory == 1: | ||
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. It looks like |
||
screenScroll(screen, (255,255,255)) | ||
Done = False | ||
while not Done: | ||
for event in pygame.event.get(): | ||
if event.type == pygame.QUIT: | ||
Done = True | ||
screen.blit(font50.render("Good job!", 1, (0,0,0)), (450, 250)) | ||
screen.blit(font50.render("You're the ultimate Oliner!'", 1, (0,0,0)), (300, 350)) | ||
screen.blit(font20.render('All course levels maxed. :)', 1, (0,0,0)), (450, 500)) | ||
pygame.display.flip() | ||
pygame.event.pump() | ||
|
||
#not implemented yet | ||
def graduation(): | ||
'''Shows graphics for graduating. Used in all endings''' | ||
screenScroll(screen, (255,255,255)) | ||
font100 = pygame.font.Font(None, 100) | ||
screen.blit(font100.render("Congratulations,", 1, (0,0,0)), (200, 175)) | ||
screen.blit(font100.render("Olin Grad!", 1, (0,0,0)), (325, 325)) | ||
grad_hat = pygame.transform.scale(pygame.image.load('Ending_pics/grad_hat.png'), (250, 200)) | ||
screen.blit(grad_hat,(350,400)) | ||
pygame.display.flip() | ||
pygame.time.delay(2000) | ||
screenScroll(screen, (255,255,255)) | ||
font50 = pygame.font.Font(None, 50) | ||
screen.blit(font100.render("You got your degree...", 1, (0,0,0)), (150, 300)) | ||
pygame.display.flip() | ||
pygame.time.delay(2000) | ||
screenScroll(screen, (0,0,0)) | ||
screen.blit(font100.render("But how will you fair", 1, (255,255,255)), (150, 300)) | ||
screen.blit(font100.render("in the real world?", 1, (255,255,255)), (170, 400)) | ||
pygame.display.flip() | ||
pygame.time.delay(2000) | ||
|
||
|
||
def badEnding(): | ||
'''Shows graphics for bad ending. Called when average is below ___. | ||
You tried? Desk jobs are all the rage these days.''' | ||
|
||
|
||
|
||
def middleEnding(): | ||
'''Shows graphics for middle ending. Called when average is above ___ but levels are not maxed. | ||
You are a leading engineer at your own startup''' | ||
|
||
|
||
|
||
def goodEnding(): | ||
'''Shows graphics for good ending. Called when levels are all maxed. | ||
You are the next Steve Jobs.''' | ||
|
||
|
||
def determine(victory, levels): | ||
'''Determines ending. | ||
Victory is value 0, 1, or 2. 0 is bad, 2 is perfect. | ||
Levels is a list of strings. Print out with for loop''' | ||
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. For code that documents itself without as many explicit docstrings and comments, consider: BAD_OUTCOME = 'bad'
MIDDLE_OUTCOME = 'middle'
PERFECT_OUTCOME = 'perfect'
…
if victory == MIDDLE_OUTCOME:
… This has the advantages that it's easy to see the intent each place the value is used, without having to find the nearest comment that describes it; that you don't need to repeat comments in each function that generates or uses these values (admittedly, not that many places in this example); that printing out |
||
graduation() | ||
if victory == 0: | ||
badEnding() | ||
if victory == 2: | ||
middleEnding() | ||
if victory == 1: | ||
goodEnding |
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.
Good job with the header comments on the files!