let yDelta = 0
let y: number[] = []
let xDelta = 0
let x: number[] = []
let rampUp = 0
let rampUpLimit = 4
basic.forever(() => {
if (x[0] == 0 && y[0] == 0) {
xDelta = 1
yDelta = 0
}
if (x[0] == 4 && y[0] == 0) {
xDelta = 0
yDelta = 1
}
if (x[0] == 4 && y[0] == 4) {
xDelta = -1
yDelta = 0
}
if (x[0] == 0 && y[0] == 4) {
xDelta = 0
yDelta = -1
}
if (rampUpLimit < rampUp) {
led.unplot(x[rampUpLimit], y[rampUpLimit])
rampUp = rampUpLimit
}
led.plot(x[0], y[0])
for (let index = rampUp; index >= 0; index--) {
x[index + 1] = x[index]
y[index + 1] = y[index]
}
rampUp = rampUp + 1
basic.pause(100)
x[0] = x[0] + xDelta
y[0] = y[0] + yDelta
})
x = []
y = []