summaryrefslogtreecommitdiff
path: root/worms.lua
diff options
context:
space:
mode:
Diffstat (limited to 'worms.lua')
-rw-r--r--worms.lua24
1 files changed, 23 insertions, 1 deletions
diff --git a/worms.lua b/worms.lua
index ebe6af1..bccf8e4 100644
--- a/worms.lua
+++ b/worms.lua
@@ -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