Skip to content

Instantly share code, notes, and snippets.

View SpaceVoyager's full-sized avatar

Yuhang Wang SpaceVoyager

View GitHub Profile
@SpaceVoyager
SpaceVoyager / blocksexample.py
Created May 21, 2016 18:02
blocksexample.py
from scene import *
import sound
class GameEnvironment(object):
def __init__(self):
self.background_speed = 1
class MyScene (Scene):
def setup(self):
@SpaceVoyager
SpaceVoyager / flyingoctopus.py
Created April 30, 2016 12:30
flyingoctopus.py
from scene import *
from PIL import Image
import sound
import random
GAME_READY = 0
GAME_PLAY = 1
GAME_DYING = 2
GAME_DEAD = 3
@SpaceVoyager
SpaceVoyager / eightqueens_0.5.py
Created April 16, 2016 19:42
eightqueens_0.5.py
# The eight queens puzzle game
import ui, sound, speech
from collections import deque
nqueens = 10
v = ui.View(background_color=(0.40, 0.80, 1.00))
board = ui.View()
v.add_subview(board)
v.present('full_screen', hide_title_bar=False , orientations=['landscape'])
#steps_label = ui.Label()
@SpaceVoyager
SpaceVoyager / eightqueens_0.4.py
Created April 2, 2016 19:36
eightqueens_0.4.py
# The eight queens puzzle game
import ui, sound, speech
from collections import deque
nqueens = 4
v = ui.View(background_color=(0.40, 0.80, 1.00))
board = ui.View()
v.add_subview(board)
v.present('full_screen', hide_title_bar=False , orientations=['landscape'])
#steps_label = ui.Label()
@SpaceVoyager
SpaceVoyager / eightqueens_0.3.py
Created March 26, 2016 20:32
eightqueens_0.3.py
# The eight queens puzzle game
import ui, sound, speech
from collections import deque
nqueens = 4
v = ui.View(background_color=(0.40, 0.80, 1.00))
board = ui.View()
v.add_subview(board)
v.present('full_screen', hide_title_bar=False , orientations=['landscape'])
#steps_label = ui.Label()
@SpaceVoyager
SpaceVoyager / 8-puzzle-solver.py.py
Created March 26, 2016 18:20
8-puzzle-solver.py.py
'''
Using Breadth-First Search to solve the 8-puzzle
Author: Yuhang Wang
'''
from collections import deque
def isAdjacent(row1, col1, row2, col2):
if abs(row1-row2) + abs(col1-col2) == 1:
return True
@SpaceVoyager
SpaceVoyager / eightqueens_0.1.py
Created March 19, 2016 18:20
eightqueens_0.1.py
# The eight queens puzzle game
import ui, sound, speech
nqueens = 8
v = ui.View(background_color=(0.40, 0.80, 1.00))
board = ui.View()
v.add_subview(board)
v.present('full_screen', hide_title_bar=False , orientations=['landscape'])
#steps_label = ui.Label()
#steps_label.frame = (30, 30, 250, 70)
@SpaceVoyager
SpaceVoyager / eightqueens_0.1.py
Created February 15, 2016 15:05
eightqueens_0.1.py
# The eight queens puzzle game
import ui
v = ui.View(background_color=(0.40, 0.80, 1.00))
board = ui.View()
v.add_subview(board)
v.present('full_screen', hide_title_bar=False , orientations=['landscape'])
#steps_label = ui.Label()
#steps_label.frame = (30, 30, 250, 70)
#steps_label.background_color = (1.00, 0.00, 0.50)
@SpaceVoyager
SpaceVoyager / eight_puzzle_v0.6.py
Created January 30, 2016 20:38
eight_puzzle_v0.6.py
import ui
import speech
import random, time
import requests
import json
import random
import urllib
from collections import deque
END_POINT = 'http://192.168.1.8:5000/puzzlescores'
@SpaceVoyager
SpaceVoyager / three_puzzle_bfs_solver.py.py
Created January 17, 2016 14:09
three_puzzle_bfs_solver.py.py
'''
Using Breadth-First Search to solve the three puzzle
Author: Yuhang Wang
'''
from collections import deque
def isAdjacent(row1, col1, row2, col2):
if abs(row1-row2) + abs(col1-col2) == 1:
return True