MAX_LENGTH_NAME = 9
BOT_NAMES = {
    "LUCAS",
    "ANN",
    "BOBBY",
    "MOLLY",
    "JESSICA",
    "DOUGLAS",
    "GARRY",
    "ELLIOT",
    "IAN",
    "SIMON",
    "LUKE",
    "SAMUEL",
    "JORDAN",
    "ANTHONY",
    "DAVID",
    "PAUL",
    "ROBIN",
    "EMMA",
    "ROSE",
    "SMITH",
    "JOHNSON",
    "WILLIAMS",
    "BROWN",
    "JONES",
    "MILLER",
    "DAVIS",
    "GARCIA",
    "RODRIGUEZ",
    "WILSON",
    "MARTINEZ",
    "ANDERSON",
    "TAYLOR",
    "THOMAS",
    "HERNANDEZ",
    "MOORE",
    "MARTIN",
    "JACKSON",
    "THOMPSON",
    "WHITE",
    "LOPEZ",
    "LEE",
    "GONZALEZ",
    "HARRIS",
    "CLARK",
    "LEWIS",
    "ROBINSON",
    "WALKER",
    "GERARD",
    "GREGORY",
}

USED_BOT_NAMES = {}

function RandomBotName()
    local rand = "loc@"..BOT_NAMES[math.random(#BOT_NAMES)]

    local playername = GetPlayerName()
    -- Pick unique name everytime
    while USED_BOT_NAMES[rand] or rand == playername do
        rand = "loc@"..BOT_NAMES[math.random(#BOT_NAMES)]
    end
    USED_BOT_NAMES[rand] = true

    return rand
end

function GetBotNames() return USED_BOT_NAMES end

function SetPlayerName(name)
    SetString("savegame.mod.player-name", name)
end

function GetPlayerName()
    local name = GetUserNickname()
    local hasName = true
    if name == "" then name = GetString("savegame.mod.player-name") end
    if name == "" then name = "loc@UI_GP_LAYOUT_PLAYER" hasName = false end
    return name, hasName
end
