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
mousewhere (mx, my, mb)
for i : 1 .. upper (x)
x (i) := my
y (i) := mx
end for
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
elsif mb = 1 and clickCount >= 1 then
drawfilloval (mx, my, 5, 5, blue)
drawline (mx, my, x (2), y (2), red)
clickCount += 1
elsif mb = 1 and clickCount >= 4 then
drawfilloval (x (7), y (7), 10, 10, white)
drawline (x (1), y (1), x (2), y (2), white)
end if
end loop
for decreasing i : 4 .. 2
x (i) := x (i - 1)
y (i) := y (i - 1)
end for
x (1) := mx
y (1) := my
end loop