diff options
| author | rebecca <ubq323@ubq323.website> | 2026-03-01 09:46:01 +0000 |
|---|---|---|
| committer | rebecca <ubq323@ubq323.website> | 2026-03-01 09:46:01 +0000 |
| commit | 7074bedeb03986ad4a0bfdaff59ce9de5ab8c9dd (patch) | |
| tree | 24288e8b2bad1a65b7af656836af56aae36a2ef0 /worms.lua | |
| parent | dad0d9d4f9c50b28df784fe7e8c5e31487a56064 (diff) | |
worms
Diffstat (limited to 'worms.lua')
| -rw-r--r-- | worms.lua | 24 |
1 files changed, 23 insertions, 1 deletions
@@ -1,4 +1,26 @@ +local NFRUITS = 10 +local NWORMS = 20 + + local M = peripheral.find"monitor" local W,H = M.getSize() -print(W,H) +local fruits = {} +for i=1,NFRUITS do + fruits[i] = {math.random(W),math.random(H)} +end + + +local function draw() + 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 |
