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

auto generated by makefile

parent 70ead4f6
No related branches found
No related tags found
No related merge requests found
......@@ -4,4 +4,7 @@ Usage (interactive):
Code: code for pattern. To exit, make an empty line Example: "return random.randint(0, 1)". Can be longer than one line. Return 1 -> alive
Delay: delay between frames
Usage (with args):
python3 game.py <conffile>
\ No newline at end of file
python3 game.py <conffile>
Challange:
1. try to calculate challanges/challange1.json
\ No newline at end of file
{
"height" : 26,
"width" : 60,
"code" : [
"return ((x - 1) // (y + 1)) % 2"
],
"DELAY" : 0,
"DEATH" : " ",
"LIFE" : "█"
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ if len(sys.argv) < 2:
LIFE = ""
DEATH = " "
DELAY = float(input("Delay: "))
PRINT = True
else:
with open(sys.argv[1], "r") as f:
conf = json.load(f)
......@@ -73,10 +74,13 @@ def check_frozen(map1, map2):
seed(MAP)
LMAP = [[DEATH for x in range(0, len(MAP[0]))] for y in range(0, len(MAP))]
while True:
draw(MAP)
if PRINT:
draw(MAP)
LMAP = [item.copy() for item in MAP.copy()]
for y in range(0, len(MAP)):
for x in range(0, len(MAP[0])):
check(MAP, x, y)
if check_frozen(MAP, LMAP):
break
\ No newline at end of file
break
if not PRINT:
draw(MAP)
\ No newline at end of file
{
"height" : 12,
"width" : 12,
"height" : 16,
"width" : 16,
"code" : [
"return random.randint(0, 1)"
],
"DELAY" : 0,
"DEATH" : " ",
"LIFE" : "█"
"LIFE" : "█",
"PRINT" : 0
}
\ No newline at end of file
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