Skip to content

Instantly share code, notes, and snippets.

View ssophwang's full-sized avatar

Sophia ssophwang

View GitHub Profile
@ssophwang
ssophwang / fibonacci.py
Created June 1, 2015 00:39
fibonacci.py
# makes Fibonacci numbers using python
def fib(s):
a = 0
b = 1
for i in range(s+1):
print a
old_a = a
a = b
b = old_a + b
s = 'bob is cool, really'
print s
@ssophwang
ssophwang / fathers_day.py
Created June 6, 2015 23:23
fathers_day.py
# A2PyKids class homework 1
import canvas
import speech
from random import random
# write a bunch of Happy Fathers Day's
canvas.set_size(1000, 600)
text = "Happy Father's Day!"
@ssophwang
ssophwang / Fathers_Day_Gift.py
Created June 7, 2015 14:59
Fathers_Day_Gift.py
# Father's Day Gift
from scene import *
class MyScene (Scene):
def draw(self):
background(1, 1, 1)
fill(1, 0, 0)
w = self.size.w
h = self.size.h
for i in range(6):
@ssophwang
ssophwang / hw2a.py
Created June 25, 2015 19:05
hw2a.py
import canvas
from random import random
canvas.set_size(1000, 600)
canvas.draw_image('_backround', 0, 0, 1000, 600)
def draw_tree(rootx, rooty, trunk_height, leaf_height, leaf_width, trunk_width):
canvas.begin_path()
canvas.move_to(rootx-leaf_width/2, rooty+trunk_height)
canvas.add_line(rootx+leaf_width/2, rooty+trunk_height)
@ssophwang
ssophwang / crazy_bubbles_homework_2.py
Created July 26, 2015 18:53
crazy_bubbles_homework_2.py
from scene import *
import math
from random import random
class MyScene (Scene):
circles = []
max_score = 0
game_began = False
speed = 5
@ssophwang
ssophwang / fish_tank.py
Created August 10, 2015 00:10
fish_tank.py
from scene import *
from random import uniform
bounds = None
class sea_creature:
def __init__(self, image_name, direction, size, speed_x, y):
self.image_name = image_name
self.direction = direction
self.size = size
@ssophwang
ssophwang / eight_puzzle.py
Created November 28, 2015 19:46
eight_puzzle.py
import ui
import speech
border_color = ('black')
moves = 0
def isAdjacent(row1, col1, row2, col2):
if abs(row1-row2) + abs(col1-col2) == 1:
@ssophwang
ssophwang / Jumping_Octopus.py
Created April 25, 2016 00:44
Jumping_Octopus.py
from scene import *
from PIL import Image
import sound
import random
GAME_READY = 0
GAME_PLAY = 1
GAME_DYING = 2
GAME_DEAD = 3
@ssophwang
ssophwang / Super_Alien.py
Created May 21, 2016 18:19
Super_Alien.py
from scene import *
import sound
class GameEnvironment(object):
def __init__(self):
self.background_speed = 2
class MyScene (Scene):
def setup(self):
self.env = GameEnvironment()