1

Implement base TurtleController and simple VolumeExcavationController

This commit is contained in:
2025-10-05 19:08:45 +02:00
commit 3bb3790f1b
8 changed files with 690 additions and 0 deletions

48
lib/stack.lua Normal file
View File

@ -0,0 +1,48 @@
---@class Stack
---@field elements table[]
local Stack = {}
Stack.__index = Stack
---@return Stack
function Stack:Create()
-- stack table
local t = {}
setmetatable(t, Stack)
-- entry table
t.elements = {}
return t
end
---@param element table
function Stack:Push(element)
if element == nil or element == {} then
return
end
table.insert(self.elements, element)
end
---@return table
function Stack:Pop()
return table.remove(self.elements)
end
---@return table
function Stack:Peek()
return table[#self.elements]
end
---@return number
function Stack:Count()
return #self.elements
end
return Stack