This file contains 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 os import walk | |
files = [] | |
for (dirpath, dirnames, filenames) in walk('./data/'): | |
files.extend(filenames) | |
break | |
data = [] | |
OFratio = None | |
for file in files: |
This file contains 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 os import walk | |
files = [] | |
for (dirpath, dirnames, filenames) in walk('./data/'): | |
files.extend(filenames) | |
break | |
for file in files: | |
t = [] | |
with open('./data/' + file) as f: |
This file contains 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
""" | |
TODO: | |
==== | |
+ Fit grid to generated structure (with a border) | |
+ Generate a few small "rooms" and combine them to a grid | |
+ Corridors | |
+ Doors? | |
+ Func to determine where rooms should go | |
""" |
This file contains 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 random, math, sys | |
from room_gen import * | |
running = True | |
winTarget = 4 # how many wins until victory | |
def rollDice(sides, times=1): | |
""" | |
Simulates the rolling of die. | |
""" |
This file contains 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 fractions import Fraction | |
def strToNum(string): | |
if '/' in string: #if user entered a fraction | |
string = string.split('/') | |
return Fraction(int(string[0]), int(string[1])) | |
elif '.' in string: #if user entered a decimal | |
return float(string) | |
else: return int(string) |
This file contains 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 strToNum(string): | |
if '/' in string: | |
num, den = string.split('/') | |
return int(num)/int(den) | |
elif '.' in string: | |
return float(string) | |
else: return int(string) | |
run = 1 | |
while run: |
This file contains 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 * | |
min, max, result = 1, 100, '' | |
while result != 'y': | |
guess = randint(min, max) | |
result = raw_input('Is your number {}? (Y|H|L) '.format(guess)).lower()[0] | |
if result == 'h': max = guess | |
elif result == 'l': min = guess | |
print "Your number is {}.".format(guess) |
This file contains 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
name, age, userName = (raw_input('Name: '), raw_input('Age: '), raw_input('Reddit Username: ')) | |
with open('UserInfo.txt', 'a') as f: | |
f.write('Name: {0}\nAge: {1}\nReddit Username: {2}\n\n'.format(name, age, userName)) | |
print 'Your name is {0}, you are {1} years old, and your username is {2}.'.format(name, age, userName) |