Lua validation for Temperatures puzzle is broken

Here’s my rough solution, which passes for all three tests in the IDE. When submitting for validation it fails in every test, suggesting that this puzzle’s lua validation is currently broken.

N = tonumber(io.read()) -- the number of temperatures to analyse

if N == 0 then print("0")
else
    TEMPS = io.read() -- the N temperatures expressed as integers ranging from -273 to 5526
    
    -- Write an action using print()
    -- To debug: io.stderr:write("Debug message\n")
    LOWESTPOS = 5526
    LOWESTNEG = -273
    TEMPTABLE = {}
    for i in string.gmatch(TEMPS, "%S+") do
        table.insert(TEMPTABLE, tonumber(i))
    end
    
    for k,v in pairs(TEMPTABLE) do
        if v  > 0 and v < LOWESTPOS then LOWESTPOS = v
        elseif v < 0 and v > LOWESTNEG then LOWESTNEG = v
        elseif v == 0 then LOWESTPOS = 0
        end
    end
    
    if LOWESTPOS <= (0 - LOWESTNEG) then print(tostring(LOWESTPOS))
    else print(tostring(LOWESTNEG))
    end
end

Hi, Lua validators doesn’t not work for In/Out Puzzle, it’s a known bug, it will be fix asap. Sorry :blush:

1 Like