function setCounter(key, value)
    return engine.Scene.Session:SetCounter(key, value)
end

function getCounter(key)
    return engine.Scene.Session:GetCounter(key)
end


function onBegin()
    local roomName = getSession().Level

    if not getFlag("explored_"..roomName) then
        setFlag("explored_"..roomName, true)
        setCounter("exploredNum_"..(roomName:sub(1,1)), getCounter("exploredNum_"..(roomName:sub(1,1))) + 1)
        setCounter("exploredTotal", getCounter("exploredTotal") + 1)
    end

    if getCounter("exploredNum_"..(roomName:sub(1,1))) > 0 then
        if not getFlag("mapUnlock_"..(roomName:sub(1,1)).."_A") then
            if getFlag("seenGream") then
                setFlag("updatedMap", true)
            end
        end
        setFlag("mapUnlock_"..(roomName:sub(1,1)).."_A", true)
    end

    if getCounter("exploredNum_"..(roomName:sub(1,1))) >= 10 then
        if not getFlag("mapUnlock_"..(roomName:sub(1,1)).."_B") then
            if getFlag("seenGream") then
                setFlag("updatedMap", true)
            end
        end
        setFlag("mapUnlock_"..(roomName:sub(1,1)).."_B", true)
    end
end

function onEnd(room, wasSkipped)

    
end