Langton's ant: Difference between revisions

Line 3,321:
Sleep
End</lang>
 
=={{header|Furor}}==
<lang Furor>
###sysinclude X.uh
$ff0000 sto szin1
$ffffff sto szin2
2 sto pausetime
maxypixel 100 - sto YRES
maxxpixel sto XRES
zero ant
// Az ant iránykódjai:
// 0 : fel
// 1 : le
// 2 : jobbra
// 3 : balra
@XRES 2 / sto antx // Az ant kezdeti koordinátái
@YRES 2 / sto anty
myscreen "Furor monitor" @YRES @XRES graphic // Create the graphic screen
."Kilépés: ESC\n"
 
infiniteloop: {... // infinite loop begins
myscreen @anty @antx [[]][[]] // A pixel színe amin az ant ül épp
@szin2 == { myscreen @anty @antx @szin1 [][] // másik színre átállítjuk a pixelt
2 // Jobbra fog fordulni
}{ myscreen @anty @antx @szin2 [][] // másik színre átállítjuk a pixelt
3 // Balra fog fordulni
}
// Elvégezzük az új koordináta beállítását:
sto direction
@ant 0 == { @direction 2 == then §r1 @direction 3 == then §r2 }
@ant 2 == { @direction 2 == then §r3 @direction 3 == then §r4 }
@ant 1 == { @direction 3 == { r1: antx @XRES ring 2 goto §beolvas } @direction 2 == { r2: antx @XRES !ring 3 goto §beolvas } }
@ant 3 == { @direction 3 == { r3: anty @YRES !ring 1 goto §beolvas } @direction 2 == { r4: anty @YRES ring 0 goto §beolvas } }
 
beolvas: sto ant
myscreen key? sto! billkód @pausetime usleep $1b ==
|...}
."Made " {...}§infiniteloop print ." steps.\n"
."XRES = " @XRES printnl
."YRES = " @YRES printnl
myscreen !graphic
end
{ „myscreen” }
{ „billkód” }
{ „pausetime” }
{ „XRES” }
{ „YRES” }
{ „szin1” }
{ „szin2” }
{ „ant” }
{ „antx” }
{ „anty” }
{ „direction” }
 
</lang>
 
=={{header|Gambas}}==
Anonymous user