-
Notifications
You must be signed in to change notification settings - Fork 0
/
Propagate.ulam
52 lines (42 loc) · 880 Bytes
/
Propagate.ulam
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
quark Propagate
{
typedef Unsigned(8) ARGB[4];
typedef Unsigned(8) ColorValue;
typedef Unsigned(8) InvPressure;
typedef Unsigned(5) Neighbour;
EventWindow ew;
InvPressure ip = 0;
Once oc;
virtual Void initSelf()
{
}
virtual Void captureSpace(Neighbour idx)
{
}
virtual Void emptySpace(Neighbour idx)
{
}
Void behave()
{
if(oc.new())
{
initSelf();
}
for(Neighbour i = 1; i < 9; ++i)
{
Atom other = ew[i];
if(other is Propagate)
{
captureSpace(i);
}
if(ew[i] is Empty)
{
emptySpace(i);
}
}
// allows the Voronnoi cells to die when the
// seed is deleted.
if(ip < 254)
ip++;
}
}