This file contains hidden or 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
# coding: utf-8 | |
''' | |
Using Depth-First Search to calculate max number of beers money can buy | |
''' | |
from collections import deque | |
def next_actions(rules, state): | |
actions = [] |
This file contains hidden or 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
from scene import * | |
import sound | |
class GameEnvironment(object): | |
def __init__(self): | |
self.background_speed = 2 | |
class MyScene (Scene): | |
def setup(self): | |
self.env = GameEnvironment() |
This file contains hidden or 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
from scene import * | |
from PIL import Image | |
import sound | |
import random | |
GAME_READY = 0 | |
GAME_PLAY = 1 | |
GAME_DYING = 2 | |
GAME_DEAD = 3 |
This file contains hidden or 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
import ui | |
import speech | |
border_color = ('black') | |
moves = 0 | |
def isAdjacent(row1, col1, row2, col2): | |
if abs(row1-row2) + abs(col1-col2) == 1: |
This file contains hidden or 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
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 |
This file contains hidden or 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
from scene import * | |
import math | |
from random import random | |
class MyScene (Scene): | |
circles = [] | |
max_score = 0 | |
game_began = False | |
speed = 5 |
This file contains hidden or 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
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) |
This file contains hidden or 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
# 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): |
This file contains hidden or 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
# 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!" |
This file contains hidden or 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
s = 'bob is cool, really' | |
print s | |