Conway's Game of Life: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 7,287:
 
=={{header|FutureBasic}}==
This is just the central routine for a small world.
<syntaxhighlight lang="futurebasic">
 
 
Short a(4, 4), c(4, 4) // Array of cells and working copy
 
void local fn initializeseed
Short x, y
// Fill three cells
Line 7,303 ⟶ 7,302:
end fn
 
void local fn calculatenextGen
Short x, y, dx, dy, n
// Calculate next generation on temporary boardarray c
for y = 1 to 3 : for x = 1 to 3 // Not the border cells
c(x, y) = 0 // Initialize
n = -a(x, y) // Don't count center cell
for dy = -1 to 1 : for dx = -1 to 1
Line 7,321 ⟶ 7,320:
end fn
 
fn initializeseed
fn calculatenextGen
fn calculatenextGen
 
handleevents
Line 7,347 ⟶ 7,346:
00000
00000
 
 
</pre>
 
Line 8,011 ⟶ 8,008:
0 0 0
1 1 1
0 0 0</syntaxhighlight>
 
</syntaxhighlight>
 
'''Example''' (showing start and six following generations of a glider)
60

edits