Conway's Game of Life: Difference between revisions
Content deleted Content added
m →{{header|PureBasic}}: endless world |
|||
Line 1,592: | Line 1,592: | ||
<lang PureBasic>EnableExplicit |
<lang PureBasic>EnableExplicit |
||
Define.i x, y ,Xmax ,Ymax ,N |
Define.i x, y ,Xmax ,Ymax ,N |
||
Xmax = |
Xmax = 13 : Ymax = 20 |
||
Dim world.i(Xmax+1,Ymax+1) |
Dim world.i(Xmax+1,Ymax+1) |
||
Dim Nextworld.i(Xmax+1,Ymax+1) |
Dim Nextworld.i(Xmax+1,Ymax+1) |
||
Line 1,610: | Line 1,610: | ||
ConsoleLocate(0,2) |
ConsoleLocate(0,2) |
||
PrintN(LSet("", Xmax+2, "-")) |
PrintN(LSet("", Xmax+2, "-")) |
||
;---------- endless world --------- |
|||
For y = 1 To Ymax |
|||
world(0,y)=world(Xmax,y) |
|||
world(Xmax+1,y)=world(1,y) |
|||
Next |
|||
For x = 1 To Xmax |
|||
world(x,0)=world(x,Ymax) |
|||
world(x,Ymax+1)=world(x,1) |
|||
Next |
|||
world(0 ,0 )=world(Xmax,Ymax) |
|||
world(Xmax+1,Ymax+1)=world(1 ,1 ) |
|||
world(Xmax+1,0 )=world(1 ,Ymax) |
|||
world( 0,Ymax+1)=world(Xmax,1 ) |
|||
;---------- endless world --------- |
|||
For y = 1 To Ymax |
For y = 1 To Ymax |
||
Print("|") |
Print("|") |
||
Line 1,625: | Line 1,639: | ||
Next |
Next |
||
PrintN(LSet("", Xmax+2, "-")) |
PrintN(LSet("", Xmax+2, "-")) |
||
Delay( |
Delay(100) |
||
Swap world() , Nextworld() |
Swap world() , Nextworld() |
||
Dim Nextworld.i(Xmax+1,Ymax+1) |
Dim Nextworld.i(Xmax+1,Ymax+1) |