Wireworld: Difference between revisions

no edit summary
(→‎{{header|Perl 6}}: Fix syntax errors)
No edit summary
Line 5,215:
SetVid(3); \restore normal text mode
]</lang>
 
=={{header|Yabasic}}==
<lang Yabasic>open window 230,130
backcolor 0,0,0
clear window
 
label circuit
DATA " "
DATA " tH......... "
DATA " . . "
DATA " ... "
DATA " . . "
DATA " Ht.. ...... "
DATA " "
DATA ""
do
read a$
if a$ = "" break
n = n + 1
redim t$(n)
t$(n) = a$+a$
loop
 
size = len(t$(1))/2
E2 = size
first = true
Orig = 0
Dest = E2
 
do
for y = 2 to n-1
for x = 2 to E2-1
switch mid$(t$(y),x+Orig,1)
case " ": color 32,32,32 : mid$(t$(y),x+Dest,1) = " " : break
case "H": color 0,0,255 : mid$(t$(y),x+Dest,1) = "t" : break
case "t": color 255,0,0 : mid$(t$(y),x+Dest,1) = "." : break
case ".":
color 255,200,0
t = 0
for y1 = y-1 to y+1
for x1 = x-1 to x+1
t = t + ("H" = mid$(t$(y1),x1+Orig,1))
next x1
next y1
if t=1 or t=2 then
mid$(t$(y),x+Dest,1) = "H"
else
mid$(t$(y),x+Dest,1) = "."
end if
end switch
fill circle x*16, y*16, 8
next x
print t$(y),"="
next y
first = not first
if first then
Orig = 0 : Dest = E2
else
Orig = E2 : Dest = 0
end if
wait .5
loop
</lang>
672

edits