-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmazes.py
More file actions
73 lines (66 loc) · 1.54 KB
/
mazes.py
File metadata and controls
73 lines (66 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from itertools import cycle, repeat
from maze import Maze
ORIGINAL = Maze(10, 10,
"0001010000"
"0111010101"
"0100000011"
"0110100010"
"0000100110"
"1111100000"
"0000001000"
"1000111010"
"0010001010"
"1100101010") * (2, 2)
OPEN = Maze(20, 20,
"10000000000001000000"
"01000001100010000000"
"01000001000111111000"
"00100011111000000100"
"00100000000000001000"
"00100000001111100000"
"00001000000000100000"
"00110110000000100000"
"00000001110000011110"
"00000100001110000000"
"00000001000001001000"
"00001111111110110010"
"00000100000000000100"
"00011000110000001000"
"00000111000000010000"
"00000000100011100000"
"00000000011100000000"
"00000000110000000000"
"00000000100000000000"
"00000000000000000000")
TIGHT = Maze(20, 20,
"00000000000000000000"
"01111111111111111110"
"00000000110000000000"
"00110111111110011111"
"00100000000000000000"
"00111111111111110010"
"00000000000000000010"
"01001111111111001110"
"10000000000000000000"
"10111111110111011111"
"00000000000000000000"
"11111111111111111110"
"00000000000000000000"
"00000000000000000000"
"01111111111111111111"
"00100100010010010100"
"00100100000010010100"
"00100100010010010100"
"00001110011011010110"
"00000000001000000000"
)
ALL = [ORIGINAL, OPEN, TIGHT]
DOUBLE = [maze * (2, 2) for maze in ALL]
def maze_cycler(mazes, repeats):
''' Cycle through mazes.
e.g. mazes = [A, B, C], repeats = 4
-> AAAABBBBCCCC
'''
for maze in cycle(mazes):
for instance in repeat(maze, repeats):
yield instance