-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPool2.ma
156 lines (103 loc) · 5.64 KB
/
Pool2.ma
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
[top]
components : table
[table]
type : cell
dim : (16,32,2)
delay : transport
defaultDelayTime : 100
border : unwrapped
neighbors : table(0,0,0) table(-1,0,0) table(0,-1,0) table(1,0,0) table(0,1,0)
neighbors : table(0,0,1) table(-1,0,1) table(0,-1,1) table(1,0,1) table(0,1,1)
neighbors : table(0,0,-1) table(-1,0,-1) table(0,-1,-1) table(1,0,-1) table(0,1,-1)
neighbors : table(1,1,1) table(1,-1,1) table(-1,1,1) table(-1,-1,1)
initialvalue : 0
initialCellsValue : Pool2.val
localTransition : nothing
link : outY@table(15,0,0) inY@table(8,28,0)
link : outY@table(0,0,0) inY@table(8,28,0)
link : outY@table(0,31,0) inY@table(8,28,0)
link : outY@table(15,31,0) inY@table(8,28,0)
portInTransition : inY@table(8,28,0) newBall
zone : ball-rule { (1,1,0)..(14,30,0) (1,0,0)..(14,0,0) (0,1,0)..(0,30,0) (1,31,0)..(14,31,0) (15,1,0)..(15,30,0) }
zone : angle-rule { (1,1,1)..(14,30,1) (1,0,1)..(14,0,1) (0,1,1)..(0,30,1) (1,31,1)..(14,31,1) (15,1,1)..(15,30,1) }
zone : pockets { (0,0,0) (15,0,0) (0,31,0) (15,31,0) (0,0,1) (15,0,1) (0,31,1) (15,31,1) }
[ball-rule]
rule : {0} 0 {((-1,0,0) = -1) and ((0,-1,0) = -4) and ((0,0,1) > 90) and ((0,0,1) < 180)}
rule : {0} 0 {((1,0,0) = -3) and ((0,-1,0) = -4) and ((0,0,1) > 180) and ((0,0,1) < 270)}
rule : {0} 0 {((1,0,0) = -3) and ((0,1,0) = -2) and ((0,0,1) > 270) and ((0,0,1) < 360)}
rule : {0} 0 {((-1,0,0) = -1) and ((0,1,0) = -2) and ((0,0,1) > 0) and ((0,0,1) < 90)}
rule : {(0,0,0)} 100 {(0,0,0) < 0}
rule : {4} 100 {(0,0,0) = 400}
rule : {23} 100 {((0,1,0) = 4) and ((1,0,0) = 1)}
rule : {2} 100 {(0,-1,0) = 23}
rule : {3} 100 {(-1,0,0) = 23}
rule : {34} 100 {((0,-1,0) = 2) and ((1,0,0) = 1)}
rule : {4} 100 {(0,1,0) = 34}
rule : {3} 100 {(-1,0,0) = 34}
rule : {14} 100 {((0,-1,0) = 2) and ((-1,0,0) = 3)}
rule : {4} 100 {(0,1,0) = 14}
rule : {1} 100 {(1,0,0) = 14}
rule : {12} 100 {((0,1,0) = 4) and ((-1,0,0) = 3)}
rule : {2} 100 {(0,-1,0) = 12}
rule : {1} 100 {(1,0,0) = 12}
rule : {13} 100 {((1,0,0) = 1) and ((-1,0,0) = 3)}
rule : {3} 100 {(-1,0,0) = 13}
rule : {1} 100 {(1,0,0) = 13}
rule : {24} 100 {((0,1,0) = 4) and ((0,-1,0) = 2)}
rule : {2} 100 {(0,-1,0) = 24}
rule : {4} 100 {(0,1,0) = 24}
rule : {3} 100 {((-1,0,0) != 0) and ((0,0,0) = 1)}
rule : {1} 100 {((1,0,0) != 0) and ((0,0,0) = 3)}
rule : {4} 100 {((0,1,0) != 0) and ((0,0,0) = 2)}
rule : {2} 100 {((0,-1,0) != 0) and ((0,0,0) = 4)}
rule : {if((-1,0,1) < 270, if(random < (1/(1 + tan((3*pi/2) - degToRad((-1,0,1))))),3,4), if(random < (1/(1 + tan(2*pi - degToRad((-1,0,1))))),2,3))} 100 {((-1,0,0) = 3) and ((0,0,0) = 0)}
rule : {if((0,-1,1) < 90, if(random < (1/(1 + tan(degToRad((0,-1,1))))),2,1), if(random < (1/(1 + tan(2*pi - degToRad((0,-1,1))))),2,3))} 100 {((0,-1,0) = 2) and ((0,0,0) = 0)}
rule : {if((1,0,1) < 90, if(random < (1/(1 + tan(degToRad((1,0,1))))),2,1), if(random < (1/(1 + tan(pi - degToRad((1,0,1))))),4,1))} 100 {((1,0,0) = 1) and ((0,0,0) = 0)}
rule : {if((0,1,1) < 180, if(random < (1/(1 + tan(pi - degToRad((0,1,1))))),4,1), if(random < (1/(1 + tan((3*pi/2) - degToRad((0,1,1))))),3,4))} 100 {((0,1,0) = 4) and ((0,0,0) = 0)}
rule : 0 100 {t}
[angle-rule]
rule : 0 100 {(0,0,-1) < 0}
rule : {0} 0 {((-1,0,-1) = -1) and ((0,-1,-1) = -4) and ((0,0,0) > 90) and ((0,0,0) < 180)}
rule : {0} 0 {((1,0,-1) = -3) and ((0,-1,-1) = -4) and ((0,0,0) > 180) and ((0,0,0) < 270)}
rule : {0} 0 {((1,0,-1) = -3) and ((0,1,-1) = -2) and ((0,0,0) > 270) and ((0,0,0) < 360)}
rule : {0} 0 {((-1,0,-1) = -1) and ((0,1,-1) = -2) and ((0,0,0) > 0) and ((0,0,0) < 90)}
rule : {0} 100 {((0,1,-1) = 4) and ((1,0,-1) = 1)}
rule : {0} 100 {((0,-1,-1) = 2) and ((1,0,-1) = 1)}
rule : {0} 100 {((0,-1,-1) = 2) and ((-1,0,-1) = 3)}
rule : {0} 100 {((0,1,-1) = 4) and ((-1,0,-1) = 3)}
rule : {0} 100 {((1,0,-1) = 1) and ((-1,0,-1) = 3)}
rule : {0} 100 {((0,1,-1) = 4) and ((0,-1,-1) = 2)}
rule : {360 - (0,0,0)} 100 {((-1,0,-1) != 0) and ((0,0,-1) = 1)}
rule : {360 - (0,0,0)} 100 {((1,0,-1) != 0) and ((0,0,-1) = 3)}
rule : {if((0,0,0) < 90,180 - (0,0,0), 540 - (0,0,0))} 100 {((0,1,-1) != 0) and ((0,0,-1) = 2)}
rule : {if((0,0,0) <= 180,180 - (0,0,0), 540 - (0,0,0))} 100 {((0,-1,-1) != 0) and ((0,0,-1) = 4)}
rule : {(-1,0,0)} 100 {((-1,0,-1) = 3) and ((0,0,-1) = 0)}
rule : {(1,0,0)} 100 {((1,0,-1) = 1) and ((0,0,-1) = 0)}
rule : {(0,1,0)} 100 {((0,1,-1) = 4) and ((0,0,-1) = 0)}
rule : {(0,-1,0)} 100 {((0,-1,-1) = 2) and ((0,0,-1) = 0)}
rule : {if(random > 0,randint(45) + 315,1 + randint(44))} 100 {(0,-1,-1) = 23}
rule : {randint(90) + 225} 100 {(-1,0,-1) = 23}
rule : {randint(90) + 135} 100 {(0,1,-1) = 34}
rule : {randint(90) + 225} 100 {(-1,0,-1) = 34}
rule : {randint(90) + 135} 100 {(0,1,-1) = 14}
rule : {randint(90) + 45} 100 {(1,0,-1) = 14}
rule : {if(random > 0,randint(45) + 315,1 + randint(44))} 100 {(0,-1,-1) = 12}
rule : {randint(90) + 45} 100 {(1,0,-1) = 12}
rule : {randint(90) + 225} 100 {(-1,0,-1) = 13}
rule : {randint(90) + 45} 100 {(1,0,-1) = 13}
rule : {if(random > 0,randint(45) + 315,1 + randint(44))} 100 {(0,-1,-1) = 24}
rule : {randint(90) + 135} 100 {(0,1,-1) = 24}
rule : {randInt(90) + 135} 100 {(0,0,-1) = 400}
rule : 0 100 {t}
[newBall]
rule : {400} 100 {portValue(thisPort) = 1}
rule : {0} 100 {t}
[pockets]
rule : { -6 + send(outY,1) } 100 {((1,1,1) > 90) and ((1,1,1) < 180) }
rule : { -6 + send(outY,1) } 100 {((-1,1,1) > 180) and ((-1,1,1) < 270) }
rule : { -6 + send(outY,1) } 100 {((-1,-1,1) > 270) and ((-1,1,1) < 360) }
rule : { -6 + send(outY,1) } 100 {((1,-1,1) > 0) and ((-1,1,1) < 90) }
rule : { -5 + send(outY,0) } 0 {(0,0,0) = -6}
rule : {-5} 100 {t}
[nothing]
rule : {0} 100 {t}