View.Set ("graphics:max,max")
var x : array 1 .. 7 of int := init (0, 0, 0, 0, 0, 0, 0)
var y : array 1 .. 7 of int := init (0, 0, 0, 0, 0, 0, 0)
var mx, my, mb : int
var clickCount : int := 0
proc up
loop
mousewhere (mx, my, mb)
exit when mb = 0
end loop
end up
loop
mousewhere (mx, my, mb)
loop
mousewhere (mx, my, mb)
if mb = 1 and clickCount = 0 then
drawfilloval (mx, my, 5, 5, blue)
clickCount += 1
up
exit
elsif mb = 1 and clickCount >= 4 then
drawfilloval (mx, my, 5, 5, blue)
drawline (mx, my, x (1), y (1), red)
drawfilloval (x (5), y (5), 10, 10, white)
drawline (x (4), y (4), x (3), y (3), white)
up
exit
elsif mb = 1 and clickCount >= 1 then
drawfilloval (mx, my, 5, 5, blue)
drawline (mx, my, x (1), y (1), red)
clickCount += 1
up
exit
end if
end loop
x (1) := mx
y (1) := my
for decreasing i : 4 .. 2
x (i) := x (i - 1)
y (i) := y (i - 1)
end for
end loop