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
Short x, y
// Fill three cells
Line 7,303 ⟶ 7,302:
end fn
void local fn
Short x, y, dx, dy, n
// Calculate next generation on temporary
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
fn
fn
handleevents
Line 7,347 ⟶ 7,346:
00000
00000
</pre>
Line 8,011 ⟶ 8,008:
0 0 0
1 1 1
0 0 0
</syntaxhighlight>
'''Example''' (showing start and six following generations of a glider)
|