GZIU6OPFB7BAIO7FRHXZP3HIIHZHARBWTCPZWZO5HVE343VYWNBAC
cell.waitTime = cell.waitTime + 1
if cell.core.waitTime == 0 then
local _, command, args = coroutine.resume(cell.core, cell.returnValue)
-- Validate that the command is not a malicious.
local valid = false
for _, fun in pairs(commands) do
if fun == command then
valid = true
cell.waitTime = cell.waitTime - 1
if cell.waitTime <= 0 then
if coroutine.status(cell.core) == "dead" then
-- TODO: kill core
else
local _, command, args = coroutine.resume(cell.core, cell.returnValue)
-- Validate that the command is not a malicious.
local valid = false
for _, fun in pairs(commands) do
if fun == command then
valid = true
end
end
if valid then
cell.waitTime, cell.returnValue = command(cell, Vector(x, y), intermediate, table.unpack(args))
cell.waitTime = cell.waitTime * 100 / cell.energy
if valid then
cell.waitTime, cell.returnValue = command(cell, Vector(x, y), intermediate, table.unpack(args))
cell.waitTime = cell.waitTime * 10 / cell.energy
end
io.write(string.format("%-5s", tostring(owner):sub(5)))
--io.write(string.format("%.5s", tostring(owner):sub(5)))
io.write(string.format("%-5s", owner or " "):sub(1, 5))
io.write("|")
end
io.write("\n|")
for x = 1, width do
local core = self:getCell(Vector(x, y)).core
io.write(core and "Core " or " ")
local Arena = require "arena"
local arena = Arena(10, 5)
arena:spawn(4, 4, "Jummit", function(core)
while true do
core.move("right")
end
end)
arena:spawn(7, 4, "Ulf", function() end)
while true do
arena:simulate()
arena:draw()
os.execute("sleep 0.01")
end