blob: af0b53efbee77ce9bcee88c17c6f8aeabeceb65f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
local NFRUITS = 10
local NWORMS = 20
local M = peripheral.find"monitor"
local W,H = M.getSize()
local fruits = {}
for i=1,NFRUITS do
fruits[i] = {math.random(W),math.random(H)}
end
local function draw()
M.setBackgroundColor(colors.black)
M.clear()
for i,f in ipairs(fruits) do
M.setCursorPos(f[1],f[2])
M.setBackgroundColor(colors.red)
M.write" "
end
end
while true do
draw()
os.sleep(0)
end
|