Skip to content
Snippets Groups Projects
Commit e8f65041 authored by Jakob Kirsch's avatar Jakob Kirsch
Browse files

auto generated by makefile

parent 2c5daf30
No related branches found
No related tags found
No related merge requests found
Usage:
Height: height of window
Width: width of window
Code: code for pattern. To exit, make an empty line Example: "return random.randint(0, 1)". Can be longer than one line
Delay: delay between frames
\ No newline at end of file
...@@ -3,6 +3,15 @@ import random, time, os ...@@ -3,6 +3,15 @@ import random, time, os
height = int(input("Height: ")) height = int(input("Height: "))
width = int(input("Width: ")) width = int(input("Width: "))
code = []
inc = input("Code: ")
while inc != "":
code.append(inc)
inc = input("Code: ")
exec("def pattern(x, y):" + '\n\t'.join(code))
LIFE = "" LIFE = ""
DEATH = " " DEATH = " "
...@@ -55,7 +64,7 @@ def check(map, x, y): ...@@ -55,7 +64,7 @@ def check(map, x, y):
def seed(map): def seed(map):
for y in range(0, len(map)): for y in range(0, len(map)):
for x in range(0, len(map[0])): for x in range(0, len(map[0])):
map[y][x] = random.choice([LIFE, DEATH]) map[y][x] = [LIFE, DEATH][pattern(x, y)]
#MAIN #MAIN
seed(MAP) seed(MAP)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment