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 Tkinter import * | |
from tkFileDialog import askopenfile | |
import csv | |
class UI(object): | |
def __init__(self): | |
#**********************************CREATE INSTANCE OF THE MANAGER CLASS******************************** | |
self.manage = Manager() | |
#*************************************FORMAT TKINTER WINDOW******************************************** | |
self.master = Tk() #self.master is the root/basic Tkinter window |
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
var tileSize : float = 10; | |
var roadSize : float = 4; | |
function BuildCity(rows:int, columns:int){ | |
for (var i:int=1;i<=rows;i+=1){ | |
for (var j:int=1;j<=columns;j+=1){ | |
var citytile : GameObject = GameObject.CreatePrimitive(PrimitiveType.Plane); | |
citytile.transform.parent = transform; | |
citytile.transform.position = Vector3(i*(tileSize + roadSize),0,j*(tileSize + roadSize)); | |
citytile.transform.localRotation = Quaternion.identity; | |
} |
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 random import randint | |
max = randint(1, 1000) | |
number = randint(0, max) | |
guess = -1 | |
print "I'm thinking of a number between 0 and %d!" %max | |
while True: | |
try: | |
guess = int(raw_input("Guess a Number: ")) | |
if guess==number: | |
print "Correct!" |
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
prompts = [ | |
["You enter a dark room with two doors. Do you want to: (1) Go through the east door or (2) Go through the west door.", 2, 3], | |
["You died."], | |
["You are in a room with a big green troll. Do you want to: (1) Attack him or (2)Go through the west door.", 1, 0], | |
["You are on a balcony. Do you want to: (1) Go inside or (2) jump off the balcony", 0, 1] | |
] | |
situation = 0 | |
while situation != 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
class game: | |
def __init__(self): | |
#Set up variables | |
self.items = {"map":[-1,-1], "knife":[2,0], "scissors":[2,0]} | |
self.coords = [0,0] | |
self.locations = [ | |
["You are in a large open field. There is a house to the south and the field extends to the east.", | |
"You are in a large open field. The field extends to the west and a dense forest surrounds you.", | |
"", | |
"You are surrounded by trees. There appears to be more light to the east.", |
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
class Board(list): | |
def __init__(self): | |
for i in range(9): | |
self.append('-') | |
def isWin(self): | |
''' | |
Returns true if either player is winning else returns false | |
''' | |
# check if any of the rows has winning combination | |
for i in range(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
def splice(l, index = 0, length = 1, *args): | |
temp = l[index:index + length-1] | |
del l[index:index + length-1] | |
for i in range(len(args)): | |
l.insert(index+i, args[i]) | |
return temp | |
def fSelect(): | |
'''Allows user to select file | |
and returns the full path''' | |
import os |
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 random import randint | |
class Die(object): | |
def __init__(self, sides=None): | |
if isinstance(sides, int): | |
self.sides = sides | |
else: | |
self.sides = 6 | |
def roll(self): | |
return randint(1, self.sides) | |
class Dice(object): |
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 -*- | |
import scene | |
keyboard_layouts = ( | |
''' | |
q w e r t y u i o p del | |
a s d f g h j k l return | |
z x c v b n m , . shift | |
.?123 space .?123 |
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 random import randint, choice | |
RIGHT,LEFT,UP,DOWN = 'right','left','up','down' | |
DIRECTIONS = { | |
'r': RIGHT, | |
'l': LEFT, | |
'u': UP, | |
'd': DOWN | |
} | |
OlderNewer