1'===================ABV PROJECT======================
2'===================MODULE 1  =======================
3Sub main ()
4Dim objchart  As Object
5Dim objbutton As Object
6Worksheets(1).Activate
7Set objbutton = ActiveSheet.Buttons.Add (670,100,96,31)
8'rem debugprint(objbutton)
9objbutton.OnAction = "life"
10objbutton.Text = "next"
11
12Set objbutton = ActiveSheet.Buttons.Add (670,150,96,31)
13objbutton.OnAction = "next100"
14objbutton.Text = "Next 100"
15
16Set objbutton = ActiveSheet.Buttons.Add (670,200,96,31)
17objbutton.OnAction = "Randomize"
18objbutton.Text = "Randomize"
19
20for i = 1 to 26
21Columns(i).ColumnWidth = 3.571429
22next i
23
24for k = 1 to 26
25 Cells(k,1).Interior.ColorIndex = 14
26 Cells(k,26).Interior.ColorIndex = 14
27 Cells(1,k).Interior.ColorIndex = 14
28 Cells(26,k).Interior.ColorIndex = 14
29next k
30
31Cells(10,10).Formula="1"
32Cells(10,11).Formula="1"
33Cells(10,12).Formula="1"
34Cells(11,10).Formula="1"
35Cells(11,11).Formula="1"
36Cells(12,10).Formula="1"
37Cells(12,11).Formula="1"
38Cells(12,12).Formula="1"
39Cells(10,14).Formula="1"
40Cells(10,15).Formula="1"
41Cells(10,16).Formula="1"
42Cells(11,14).Formula="1"
43Cells(11,15).Formula="1"
44Cells(12,14).Formula="1"
45Cells(12,15).Formula="1"
46Cells(12,16).Formula="1"
47
48Worksheets(1).Activate
49End Sub
50
51Sub next100()
52for i = 1 to 100
53call life()
54call repaint()
55next i
56End sub
57
58Sub Randomize()
59for i = 2 to 25
60 for j = 2 to 25
61  Cells(i,j).Value = int( randbetween(0,1))
62 next j
63next i
64call life()
65end sub
66
67
68Sub life()
69for kk = 1 to 1
70
71for i = 2 to 25
72 for j = 2 to 25
73
74npar = 0.0
75
76If Cells(i-1,j-1) > 0.0 Then
77npar = npar + 1
78End If
79If Cells(i,j-1) > 0.0 Then
80npar = npar + 1
81End If
82If Cells(i+1,j-1) > 0.0 Then
83npar = npar + 1
84End If
85
86If Cells(i-1,j) > 0.0 Then
87npar = npar + 1
88End If
89If Cells(i+1,j) > 0.0 Then
90npar = npar + 1
91End If
92
93If Cells(i-1,j+1) > 0.0 Then
94npar = npar + 1
95End If
96If Cells(i,j+1) > 0.0 Then
97npar = npar + 1
98End If
99If Cells(i+1,j+1) > 0.0 Then
100npar = npar + 1
101End If
102
103If Cells(i,j) > 0.0 Then
104 If npar <2 or npar > 3  Then
105  Cells(i+25,j+25).value = 0.0
106 Else
107  Cells(i+25,j+25).value = Cells(i,j) + 1
108 End If
109End If
110
111If Cells(i,j)=0 and npar = 3 Then
112  Cells(i+25,j+25).value = 1.0
113End If
114
115next j
116next i
117
118for e = 2 to 25
119 for f = 2 to 25
120  Cells(e,f).value = Cells(e+25,f+25).value
121
122If Cells(e,f) > 9 Then
123 Cells(e,f) = 0.
124End If
125
126Select Case Cells(e,f)
127
128Case 7
129  Cells(e,f).Interior.ColorIndex =  5
130  Cells(e,f).Font.ColorIndex =  5
131Case 6
132  Cells(e,f).Interior.ColorIndex =  6
133  Cells(e,f).Font.ColorIndex =  6
134Case 5
135  Cells(e,f).Interior.ColorIndex = 14
136  Cells(e,f).Font.ColorIndex = 14
137Case 4
138  Cells(e,f).Interior.ColorIndex = 22
139  Cells(e,f).Font.ColorIndex = 22
140Case 3
141  Cells(e,f).Interior.ColorIndex = 21
142  Cells(e,f).Font.ColorIndex = 21
143Case 2
144  Cells(e,f).Interior.ColorIndex = 29
145  Cells(e,f).Font.ColorIndex = 29
146Case 1
147  Cells(e,f).Interior.ColorIndex = 30
148  Cells(e,f).Font.ColorIndex = 30
149Case 0
150  Cells(e,f).Interior.ColorIndex = 20
151  Cells(e,f).Font.ColorIndex = 20
152Case Else
153  Cells(e,f).Interior.ColorIndex =  4
154  Cells(e,f).Font.ColorIndex = 4
155End Select
156
157next f
158next e
159
160repaint()
161
162next kk
163
164End Sub
165
166
167
168
169
170
171Sub absmain ()
172'Do not edit this macro, changes will not be saved with the workbook!!!
173Worksheets(1).Name = "Life"
174Worksheets(2).Name = "B"
175Worksheets(3).Name = "C"
176Worksheets(1).Activate
177End Sub
178