FANDOM


-- Written by Shining-Armor
 
local p = {}
local bingo = mw.loadData( 'Module:Bingo/data' )
local entries = {}
 
local function randomEntry()
    rand = tostring(math.random(0, 23))
 
    if not entries[rand] then
        entries[rand] = true
        return bingo[rand]
    else
        return randomEntry()
    end
end
 
function p.generate( frame )
    math.random(1, 3)
    cols = 0
    rows = 0
    card = [[{| class="va-table va-table-center"
! style="font-size:300%; width:100px; height:50px"|B
! style="font-size:300%; width:100px; height:50px"|I
! style="font-size:300%; width:100px; height:50px"|N
! style="font-size:300%; width:100px; height:50px"|G
! style="font-size:300%; width:100px; height:50px"|O]]
 
    card = card .. "\n"
 
    for cols = 1, 5, 1 do
        card = card .. "|- style=\"height:100px\"\n"
        for rows = 1, 5, 1 do
            if cols == 3 and rows == 3 then
                card = card .. "| [[File:Gametitle-FO4.png|80px]]\n"
            else
                card = card .. "| " .. randomEntry() .. "\n"
            end
        end
    end
 
    card = card .. "|}"
 
    return frame:preprocess(card)
end
 
return p