User File #638173277142257583

Upload All User Files

#638173277142257583 - gbc flooder brute force script

plswork.lua
Game: Flooder ( GBC, see all files )
64 downloads
Uploaded 4/17/2023 11:28 AM by Cephla (see all 19)
actually wrote this one myself (which explains why it's so bad) and it works exactly as intended. to run, you need to start the game and do the first move yourself, then modify the section inside the first while loop before the second so it can only select neighbouring colours. After that, it should run smoothly and may give you a solution in 10 or so minutes depending on which pattern you choose.
I'm currently working on the second possible pattern and after slimming it down, it's 348 frames long, only 16 longer than my none botted tas I did ages ago. Will see what happens when I optimise this solution further
local startaddress = 0x1F35
local endaddress = 0x1FF8

while mainmemory.readbyte(0x1992) == 0 do
    -- selecting one of the three possible colours on go 2
    local random_count = math.random(1, 3) --for slecting a random colour on go 2
    if random_count == 1 then
        for i = 1, 2 do
            joypad.set({Up=true})
            emu.frameadvance()
            joypad.set({})
            emu.frameadvance()
        end
        -- set colour
        joypad.set({A=true})
        emu.frameadvance()
    elseif random_count == 2 then
        for i = 1, 3 do
            joypad.set({Up=true})
            emu.frameadvance()
            joypad.set({})
            emu.frameadvance()
        end
        -- set colour
        joypad.set({A=true})
        emu.frameadvance()
    else
        for i = 1, 5 do
            joypad.set({Up=true})
            emu.frameadvance()
            joypad.set({})
            emu.frameadvance()
        end
        -- set colour
        joypad.set({A=true})
        emu.frameadvance()
    end

    -- while loop for goes 3-end
    while mainmemory.readbyte(0x1FFD) > 0 do
        savestate.saveslot(2)
        local random_count = math.random(1, 5) --for slecting a random colour
        local prev_color = mainmemory.readbyte(0x1F35)
        local prev_coloramt = 0

        -- generate a random colour
        for i = 1, random_count do
            joypad.set({Up=true})
            emu.frameadvance()
            joypad.set({})
            emu.frameadvance()
        end

        for i = 1, 5 do
            emu.frameadvance()
        end

        -- get amount of pixels for colour that is going to be played
        local new_color = mainmemory.readbyte(0x1F2C)
        local new_colorprevamt = 0 -- amount of pixels of colour before being played
        for i = startaddress, endaddress do
            if mainmemory.readbyte(i) == mainmemory.readbyte(0x1F2C) then
                new_colorprevamt = new_colorprevamt + 1
            end
        end

        -- set colour
        joypad.set({A=true})
        emu.frameadvance()

        -- skip potential lag frames
        for i = 1, 10 do
            joypad.set({})
            emu.frameadvance()
        end

        savestate.saveslot(3)

        joypad.set({Up=true})
        emu.frameadvance()
        joypad.set({A=true})
        emu.frameadvance()
        joypad.set({})
        for i = 1, 5 do
            emu.frameadvance()
        end

        local new_coloramt = 0
        -- get amount of pixels of selected colour
        for i = startaddress, endaddress do
            if mainmemory.readbyte(i) == new_color then
                new_coloramt = new_coloramt + 1
            end
        end

        print(new_coloramt,new_colorprevamt)

        if new_coloramt < new_colorprevamt then
            savestate.loadslot(3)
        elseif new_coloramt == new_colorprevamt then 
            savestate.loadslot(2)
            print("Retrying")
        end
    end 
    savestate.loadslot(1)
end
print("Solution found")
emu.pause()