2,875
edits
No edit summary |
No edit summary |
||
Line 89: | Line 89: | ||
return obstacleInfo | return obstacleInfo | ||
end | |||
function p.calculateCourse(obstacles, checkDoubleSlots) | |||
-- Collect all obstacles and filter out nill values. | |||
local courseObstacles = {} | |||
local courseSlots = {} | |||
for _, v in obstacles do | |||
local currObstacle = getObstacle(v) | |||
if currObstacle then | |||
if checkDoubleSlots and courseSlots[currObstacle.Slot] == true then | |||
error('There are two or more obstacles in the same slot. Obstacle: ' .. currObstacle.Name .. ' Slot: ' .. currObstacle.Slot) | |||
end | |||
courseSlots[currObstacle.Slot] = true | |||
table.insert(courseObstacles, currObstacle) | |||
end | |||
end | |||
-- Calculate the highest level requirements and the total amount of items | |||
-- required to build this agility course. | |||
local courseLevelRequirements = {} | |||
local courseItemCosts = {} | |||
for _, course in courseObstacles do | |||
end | |||
end | end | ||
Line 98: | Line 125: | ||
function p._main(args) | function p._main(args) | ||
local obstacleNames = {} | |||
for i = 1, #args do | |||
if args[i] then | |||
table.insert(obstacleNames, args[i]:match("^%s*(.-)%s*$")) | |||
end | |||
end | |||
calculateCourse(obstacleNames, true) | |||
return | |||
end | end | ||
edits