package.path = "./commands/?.lua;"
console.clear()
movement = loadfile('movement.lua')
m = movement()

scriptName = "Script2"

custom1 = {
    {'u', 1},
    {'grass_cycle', 1}
}
custom2 = {
    {'r', 1},
    {'grass_cycle', 1}
}
custom3 = {
    {'d', 1},
    {'grass_cycle', 1}
}
custom4 = {
    {'l', 1},
    {'grass_cycle', 1}
}

custom5 = {
    {'w', 30},
    {'spin', 48},
    {'w', 900}, -- battle started
    {'l', 2},
    {'u', 2},
    {'use_move', 1},
    {'press_b', 15},
    {'u', 1}, -- realign against wall
    {'w', 30},
    {'r', 1}, -- prevent wall bump movement
}
custom6 = {
    {'r', 1},
    {'w', 30},
    {'spin', 48},
    {'w', 1080},
    {'l', 3},
    {'u', 3},
    {'press_a', 1},
    {'w', 360},
    {'press_a', 1},
    {'w', 1280},
    {'press_b', 1},
    {'w', 360},
    {'press_b', 1},
    {'w', 360},
    {'press_a', 1},
    {'w', 360},
    {'press_a', 1},
    {'w', 1280},
    {'press_b', 1},
    {'w', 360},
    {'press_b', 1},
    {'w', 360},
}
custom7 = {
    {'u', 1},
    {'w', 990}, -- begin grass run cycle
    {'press_b', 1},
    {'w', 360},
    {'press_b', 1},
    {'w', 360},
    {'press_b', 1},
    {'w', 360},
    {'press_b', 1},
    {'w', 360},
    {'x', 15},
    {'d', 2},
    {'rf', 10},
    {'x', 15},
    {'a', 60},
    {'w', 360},
    {'press_b', 1},
    {'w', 360}, -- end grass run cycle
    {'u', 23},
    {'w', 60},
    {'d', 13},
    {'r', 5},
    {'u', 2},
    {'w', 540},
    {'u', 6},
    {'w', 60},
    {'a', 60},
    {'w', 360},
    {'a', 60},
    {'w', 360},
    {'a', 60},
    {'w', 360},
    {'r', 1},
    {'a', 60},
    {'w', 550},
    {'press_b', 1},
    {'w', 360},
    {'press_b', 1},
    {'w', 360},
    {'press_b', 1},
    {'w', 360},
    {'press_b', 1},
    {'w', 360},
    {'d', 8},
    {'w', 540},
    {'l', 5},
    {'d', 11},
}
custom8 = {
    {'r', 1},
    {'w', 30},
    {'spin', 48},
    {'w', 1080},
    {'l', 3},
    {'u', 3},
    {'use_move', 2},
    {'w', 1280},
    {'press_b', 12},
    {'w', 40},
}
custom9 = {
    {'custom1', 1},
    {'u', 23},
    {'w', 60},
    {'d', 13},
    {'r', 5},
    {'u', 2},
    {'w', 540},
    {'u', 6},
    {'w', 60},
    {'a', 60},
    {'w', 180},
    {'a', 60},
    {'w', 360},
    {'a', 60},
    {'w', 360},
    {'r', 1},
    {'a', 60},
    {'w', 550},
    {'press_b', 10},
    {'w', 60},
    {'d', 8},
    {'w', 540},
    {'l', 5},
    {'d', 11},
}
custom10 = {
    {'custom8', 10},
    {'custom9', 1},
}
custom11 = {
    {'custom6', 10},
    {'custom7', 1},
}

run_daycare = { -- repurpose to hatch egg
    {'lf', 200},
    {'rf', 200}
}
a = {
    {'l', 5}, -- go to mart
    {'u', 5},
    {'l', 9},
    {'u', 7},
    {'l', 7},
    {'u', 2},
    {'w', 360},
    {'u', 4},
    {'w', 60},
    {'press_a', 1},
    {'w', 60},
    {'press_a', 1},
    {'w', 60},
--$# breakpoint, fixing potion debacle
{'d', 1},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'u', 2},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'press_a', 1},
{'w', 120},
{'d', 1},
{'w', 60},
--done fixing debacle
    {'press_a', 1},
    {'w', 180},
    {'u', 2},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 1},
    {'w', 60},
    {'d', 7},
    {'w', 60},
    {'press_a', 1},
    {'w', 180},
    {'u', 9},
    {'press_a', 1},
    {'w', 120},
    {'press_a', 1},
    {'w', 120},
    {'press_b', 10}, -- done buying repels and potions
    {'d', 6},
    {'w', 540},
    {'r', 7},
    {'d', 7},
    {'r', 9},
    {'d', 9},
    {'l', 4},
    {'d', 2},
    {'l', 13},
    {'u', 2},
    {'l', 17},
    {'u', 13},
    {'l', 9},
    {'press_b', 23}, -- done talking to nerd boy
    {'d', 5},
    {'w', 60},
    {'reset_start', 1},
    {'w', 60},
    {'x', 15},
    {'w', 60},
    {'u', 4},
    {'w', 60},
    {'press_a', 1},
    {'w', 360},
    {'press_a', 1},
    {'w', 60},
    {'press_a', 1},
    {'w', 60},
    {'press_b', 9}, -- used repel 
    {'u', 5},
    {'l', 5},
    {'w', 720},
    {'l', 24},
    {'w', 540},
    {'l', 6},
    {'d', 4},
    {'l', 2},
    {'d', 4},
    {'w', 60},
    {'l', 17},
    {'d', 2},
    {'l', 16},
    {'d', 2},
    {'l', 25},
    {'press_b', 23},
    {'l', 7},
    {'press_b', 4},
    {'l', 5},
    {'d', 5},
    {'l', 9},
    {'u', 19},
    {'r', 6},
    {'u', 3},
    {'press_b', 65}, -- start battle with grunts
    {'w', 1220},
    {'press_a', 1}, -- mach punch glameow
{'w', 60},
{'r', 1},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 2400}, -- double battle wait time :O
{'press_a', 40}, -- handle monferno xp edge case 
{'press_b', 12}, -- return to menu
{'press_a', 1},
{'w', 60},
{'d', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'press_a', 1}, -- return on stunky
{'w', 900},
{'press_b', 105}, -- potentially poisoned :(
    {'w', 360},
    {'d', 3},
    {'l', 5},
    {'d', 19},
    {'r', 7},
    {'d', 7},
    {'l', 3},
    {'d', 10},
    {'r', 7},
    {'u', 2},
    {'w', 540},
    {'pokecenter_heal', 1}, -- heal off poison maybe
    {'save', '01-AfterDoubleBattle'},
    {'w', 60},
    {'d', 8},
    {'w', 360},
    {'l', 6},
    {'d', 32},
    {'l', 4},
    {'d', 3},
    {'w', 120},
    {'d', 12},
    {'w', 120},
    {'d', 1},
    {'r', 2},
    {'use_repel', 1},
    {'r', 9},
    {'d', 7},
    {'r', 3},
    {'d', 15},
    {'l', 36},
    {'d', 4},
    {'w', 120},
    {'d', 3},
    {'l', 19},
    {'u', 3},
    {'l', 11},
    {'press_b', 5},
    {'l', 39},
    {'w', 120},
    {'l', 3},
    {'u', 8},
    {'w', 540},
    {'u', 8},
    {'r', 1},
    {'save', '02-BeforeVerityTraining'},
    -- lake verity loop 
    -- need to get at least 12 HP EVs to beat Mars at intended level (22)
    -- can guarentee getting at least 12 HP EVs by fighting the bidoofs in the grass
    -- over the course of 70 fights, 57 will be starly and 13 bidoof in worst case
    -- this gives us the HP EVs needed to survive Mars' Purugly fake out and scratch crits
    {'u', 3}, -- start lake verity loop
    {'r', 2}, -- into grass
    {'custom5', 24}, -- use up flame wheels
    -- need to avoid alignment movements prior to move switch
    {'w', 30},
    {'spin', 48},
    {'w', 900}, -- battle started
    {'l', 2},
    {'u', 2},
    {'use_move', 1},
    {'press_b', 15},
    {'save', '02a-AfterFlameWheel'},
    {'x', 15}, -- switch position of moves
    {'w', 60},
    {'u', 1},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 2},
    {'w', 180},
    {'l', 2},
    {'w', 60},
    {'press_a', 1},
    {'w', 60},
    {'press_a', 1},
    {'d', 1},
    {'w', 15},
    {'press_a', 1},
    {'press_b', 9}, -- done
    {'u', 1}, -- realign against wall
    {'w', 30},
    {'r', 1}, -- prevent wall bump movement
    {'custom5', 29},
    -- need to avoid alignment movements prior to move switch
    {'w', 30},
    {'spin', 48},
    {'w', 900}, -- battle started
    {'l', 2},
    {'u', 2},
    {'use_move', 1},
    {'press_b', 15},
    {'save', '02b-AfterMachPunch'},
    {'x', 15}, -- switch position of moves
    {'w', 60},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 2},
    {'w', 180},
    {'l', 2},
    {'w', 60},
    {'press_a', 1},
    {'w', 60},
    {'press_a', 1},
    {'u', 2},
    {'w', 15},
    {'press_a', 1},
    {'press_b', 10},
    {'u', 1}, -- realign against wall
    {'w', 30},
    {'r', 1}, -- prevent wall bump movement
    {'custom5', 15}, -- done with training
    {'save', '03-AfterTraining'},

    -- breakpoint for divergence
    {'custom4', 2},
    {'l', 2},
    {'w', 60},
    {'d', 8},
    {'l', 2},
    {'d', 3},
    {'reset_start', 1},
    {'r', 2},
    {'d', 3},
    {'w', 540},
    {'d', 8},
    {'r', 8},
    {'d', 2},
    {'r', 29},
    {'u', 2},
    {'r', 1},
    {'x', 15},
    {'w', 60},
    {'u', 4},
    {'x', 15},
    {'w', 60},
    {'use_repel', 1},
    {'r', 31},
    {'u', 9},
    {'r', 39},
    {'u', 19},
{'l', 6},
{'w', 60},
{'press_b', 2},
{'use_repel', 1},
{'l', 14},
{'u', 10},
{'r', 9},
{'d', 4},
{'r', 15},
{'u', 15},
{'l', 14},
{'u', 26},
{'w', 60},
{'press_b', 3},
{'u', 4},
{'r', 7},
{'u', 2},
{'w', 540},
{'pokecenter_heal', 1},
{'d', 8},
{'w', 540},
{'l', 7},
{'u', 17},
{'l', 5},
{'u', 18},
{'r', 5},
{'u', 22},
{'l', 2},
{'u', 2},
{'use_repel', 1},
{'u', 12},
{'l', 3},
{'u', 6},
{'w', 540},
{'u', 6},
{'r', 3},
{'w', 60},
{'press_a', 1},
{'press_b', 5},
{'w', 60},
{'x', 15},
{'w', 60},
{'press_a', 1},
{'w', 360},
{'l', 1},
{'w', 30},
{'l', 1},
{'w', 30},
{'l', 1},
{'w', 30},
{'l', 1},
{'w', 30},
{'l', 1},
{'w', 30},
{'d', 1},
{'w', 60},
{'press_a', 22},
{'press_b', 12},
{'r', 1},
{'w', 60},
{'press_a', 4},
{'press_b', 6},
{'w', 360},
{'r', 6},
{'d', 2},
{'w', 540},
{'x', 15},
{'press_a', 1},
{'w', 360},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'press_b', 6},
{'l', 9},
{'u', 8},
{'r', 5},
{'w', 60},
{'press_a', 1},
{'press_b', 3},
{'w', 1080},
{'u', 1},
{'press_a', 1},
{'r', 1},
{'press_a', 1},
{'w', 1260},
{'press_b', 16},
{'use_move', 1},
{'press_b', 16},
{'w', 360},
{'d', 4},
{'r', 4},
{'w', 60},
{'press_a', 1},
{'press_b', 9},
{'r', 2},
{'u', 4},
{'u', 5},
{'r', 3},
{'u', 3},
{'w', 540},
{'press_b', 3},
{'w', 1260},
{'u', 1}, -- cursor
{'press_a', 1},
{'r', 1},
{'use_move', 1},
{'press_b', 10},
{'use_move', 1},
{'press_b', 10},
{'u', 2},
{'l', 13},
{'u', 17},
{'press_b', 8},
{'save', '04-InFloaroma'},

{'w', 60}, -- in floaroma
-- breakpoint
{'r', 12}, -- go buy potion to align with previous mine sequence
{'u', 11},
{'r', 3},
{'u', 2},
{'w', 540},
{'u', 4},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 240},
{'d', 1},
{'w', 60},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 240},
{'press_a', 1},
{'w', 180},
{'press_b', 12},
{'d', 6},
{'w', 540}, -- done

{'d', 3}, -- go to girl
{'r', 27},
{'w', 60}, -- done

{'press_a', 1}, --  potential breakpoint
{'press_b', 14},
{'l', 8},
{'u', 4},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 2}, -- berry time
{'press_b', 9},
{'l', 2},
{'u', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 2},
{'press_b', 9},
{'l', 24},
{'u', 8},
{'l', 2},
{'u', 1},
{'press_a', 4},
{'press_b', 4},
{'r', 5},
{'u', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 3},
{'press_b', 6},
{'r', 3},
{'u', 13},
{'l', 19},
{'d', 3},
{'l', 4},
{'u', 3},
{'w', 540}, -- into meadow

{'u', 6},
{'w', 120},
{'press_b', 17},
{'w', 1080},
{'u', 1},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'use_move', 1}, -- potentially ko stunky, 
{'press_b', 47}, -- cancel through dialogue
{'w', 720}, -- potentially be starting next fight
{'press_b', 9},
{'u', 2},
{'press_a', 1},
{'r', 1},
{'use_move', 1}, -- ko stunky or first zubat
{'press_b', 42},
{'w', 720},
{'press_b', 12},
{'u', 2},
{'press_a', 1},
{'r', 4},
{'use_move', 1}, -- ko second zubat or first zubat
{'w', 180},
{'press_b', 49},
{'use_move', 1}, -- ko second zubat
{'press_b', 60}, -- begone honey man
{'save', '05-DoneWithHoneyMan'},

{'d', 8},
{'w', 540},
{'l', 3},
{'d', 24},
{'r', 13},
{'d', 3},
{'r', 4},
{'u', 2},
{'w', 540},
{'pokecenter_heal', 1},
{'d', 8},
{'w', 540},
{'r', 14},
{'u', 6},
{'r', 55},
{'w', 60}, -- maybe bump reset?
{'u', 4},
{'r', 2},
{'u', 4},
{'w', 60},
{'press_a', 1},
{'press_b', 10},
{'w', 1260},
{'u', 1},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'d', 1},
{'use_move', 1},
{'w', 300},
{'press_b', 45},
{'u', 1},
{'press_a', 6},
{'press_b', 3},
{'u', 1},
{'w', 540},
{'press_b', 12},
{'l', 10},
{'u', 5},
{'r', 2},
{'u', 4},
{'w', 60},
{'press_a', 1}, -- fight grunt
{'press_b', 3},
{'w', 1080},
{'u', 1},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'use_move', 1},
{'press_b', 23},
{'save', '06-BeforeMars'},

{'l', 2}, -- go to mars
{'u', 3},
{'r', 7},
{'d', 2},
{'r', 7},
{'u', 2},
{'r', 4},
    -- mars has lvl 15 zubat and lvl 17 purugly
    -- zubat basically can't do anything if we taunt it
    -- and we need 2 turns to KO it, so no OHKO flame wheel 
    -- purugly outspeeds low-speed monfernos, and knows fake out
    -- which outspeed mach punch first turn
    -- the strategy is thus:
        -- taunt zubat, then mach punch twice
        -- max damage mach punch crit on highest ATK monfernos
            -- only deals ~95% of zubat's hp
        -- which means we can guarentee a 3 turn KO by doing
            -- mach punch -> mach punch -> flame wheel
        -- this lets us know when our first turn against purugly is
        -- since fake out will flinch us anyway, we can use a potion
        -- to heal back damage zubat did with bite
        -- purugly hp -> 53
        -- monferno hp -> 61
        -- scenario 1, nature is -def
            -- purugly max dmg -> 30
            -- monferno min damage -> 32
            -- monferno KOs in 2 hits, dealing 64 dmg, overcoming 
            -- the oran berry, which puts purugly at 63hp
                -- First hit from purugly is fake out, which puts us at 31
                -- second turn, mach punch brings purugly to 21 -> 31
                -- scratch max crit brings us to 1 hp
                -- third turn, mach punch will KO 31 -> 0 
        -- scenario 2, nature is -atk
            -- purugly max dmg -> 27
            -- monferno min dmg -> 30
                -- First turn, fake out max crit puts us at 34
                -- second turn, mach punch puts purugly to 23
                    -- oran berry triggers, putting purugly to 33
                    -- scratch max crit puts us at 7
                -- third turn, we super potion
                    -- health goes to 57
                    -- scratch max crit brings us to 30
                -- fourth turn
                    -- mach punch brings purugly to 3
                    -- scratch max crit brings us to 3
                -- fifth turn
                    -- mach punch KOs, fight over with 3 hp
        -- both scenarios resolve because in the -def scenario, using 
            -- a super potion is just buying an extra turn, it's stalling
            -- and we still KO afterwards anyway.
            {'r', 2},
            {'w', 60},
            {'press_b', 21},
            {'w', 1260},
            {'u', 1},
            {'press_a', 1},
            {'w', 60},
            {'d', 1},
            {'use_move', 1}, -- use taunt
            {'w', 60},
            {'press_a', 1},
            {'w', 60},
            {'r', 1},
            {'use_move', 2}, -- double mach punch to soften zubat
            {'press_a', 1},
            {'u', 1},
            {'press_a', 1}, -- guarenteed flame wheel ko
            {'w', 1480}, -- purugly comes out
            {'d', 1},
            {'press_a', 1},
            {'w', 60},
            {'press_a', 1}, 
            {'w', 60},
            {'r', 2},
            {'press_a', 1},
            {'w', 60},
            {'press_a', 1},
            {'w', 120},
            {'press_a', 1},
            {'w', 980}, -- potion used
            {'u', 1},
            {'press_a', 1},
            {'w', 60},
            {'d', 1},
            {'use_move', 1}, -- mach punch num 1
            {'w', 120},
            {'d', 1},
            {'press_a', 1},
            {'w', 60},
            {'d', 3},
            {'w', 60},
            {'press_a', 1},
            {'w', 60},
            {'press_a', 1},
            {'w', 120},
            {'press_a', 1},
            {'w', 1080}, -- potion again
            {'u', 1},
            {'press_a', 1},
            {'w', 60},
            {'use_move', 2}, -- mach punch 2 and 3 depending on if we have low def or atk
            {'press_b', 77}, -- reunite the girl with dad 
            {'l', 7}, -- leave the windworks
            {'d', 2},
            {'l', 7},
            {'u', 2},
            {'l', 5},
            {'d', 9},
            {'r', 10},
            {'d', 3},
            {'w', 720},
            {'press_b', 41}, -- talk to looker
            {'w', 60},
            {'d', 3},
            {'r', 4},
            {'d', 1},
            {'w', 60},
            {'press_a', 1},
            {'press_b', 8},
            {'d', 4},
            {'l', 52},
            {'u', 2},
            {'l', 15},
            {'d', 6},
            {'l', 6},
            {'u', 2},
            {'w', 420},
            {'pokecenter_heal', 1}, -- healed bby
            {'save', '07-AfterMars'},

            {'d', 8},
            {'w', 420},
            {'d', 2},
            {'reset_start', 1},
            {'w', 60},
            {'x', 15}, -- put mach punch first
            {'w', 60},
            {'d', 2},
            {'w', 60},
            {'press_a', 1},
            {'w', 360},
            {'press_a', 2},
            {'w', 360},
            {'r', 1},
            {'w', 60},
            {'r', 2},
            {'w', 60},
            {'press_a', 1},
            {'w', 60},
            {'u', 2},
            {'press_a', 1},
            {'d', 2},
            {'press_a', 1},
            {'w', 60},
            {'press_b', 13},
            
            {'r', 14},
            {'u', 9},
            {'r', 29},
            {'u', 15},
            {'l', 2},
            {'u', 2},
            {'l', 1},
            {'w', 60},
            {'press_a', 3},
            {'press_b', 17},
            {'w', 540},
            {'use_move', 2}, -- face ponyta
            {'press_b', 5},
            {'w', 420},
            {'press_b', 4},
            {'u', 5},
            {'l', 2},
            {'x', 15},
            {'w', 60},
            {'d', 1},
            {'w', 60},
            {'press_b', 1},
            {'w', 60},
            {'use_repel', 1},
            {'l', 7},
            {'u', 5},
            {'r', 3},
            {'u', 1},
            {'w', 60},
            {'press_a', 3},
            {'press_b', 22},
            {'w', 360},
            {'use_move', 5}, -- defeat geodudes
            {'press_b', 10},
            {'w', 420},
            {'r', 4},
            {'d', 2},
            {'press_a', 3},
            {'press_b', 4},
            
            {'l', 5},
            {'u', 6},
            {'r', 7},
            {'u', 1},
            {'w', 60},
            {'press_a', 2}, -- defeat roselia 
            {'press_b', 11},
        
            {'w', 780},
            {'press_a', 1},
            {'w', 60},
            {'r', 1},
            {'use_move', 1},
            {'press_b', 24},
            {'w', 60}, -- at about 8 hp 
                     
            {'l', 9},
            {'u', 6},
            {'r', 3},
            {'w', 720},
            {'press_b', 13},
            {'w', 720},
            {'use_move', 1}, -- mach punch aipom
            {'w', 180},
            {'press_b', 13}, -- defeat camper
            
            {'l', 4}, -- backtrack to pokecenter
            {'d', 23},
            {'r', 6},
            {'u', 2},
            {'r', 7},
            {'d', 12},
            {'l', 7},
            {'w', 240},
            {'press_b', 5},
            {'l', 1},
            {'w', 60},
            {'press_b', 5},
            {'w', 60},
            {'l', 1},
            {'w', 60},
            {'press_b', 5},
            {'w', 60},
            {'l', 1},
            {'w', 60},
            {'press_b', 5},
            {'l', 27},
            {'d', 3},
            {'l', 4},
            {'d', 5},
            {'l', 4},
            {'u', 4},
            {'w', 720},
            {'pokecenter_heal', 1},
            {'save', '08-IdkWhatsGoingOnHere'},

            {'press_b', 3},
            {'d', 8},
            {'w', 720},
            {'r', 14}, -- back to the grind
            {'u', 8},
            {'r', 29},
            {'u', 19},
            {'l', 3},
            {'use_repel', 1}, -- repel bcuz im lazy ;)
            {'l', 8},
            {'u', 13},
            {'l', 2},
            {'u', 52},
            {'w', 60},
            {'r', 3},
            {'d', 1},
            {'press_a', 3}, -- defeat 
            {'press_b', 6},
            {'w', 900},
            {'use_move', 2}, -- onix down
            {'press_b', 14},
            {'u', 7},
            {'w', 720},
            {'press_b', 5},
            {'w', 900},
            {'press_a', 1},
            {'w', 60},
            {'r', 1},
            {'w', 60},
            {'use_move', 2}, -- machop down but now we are weak
            {'press_b', 17},
            {'u', 2},
            {'l', 6},
            {'d', 1},
            {'press_a', 3}, -- snag that repel
            {'press_b', 3},
            {'r', 8},
            {'d', 10},
            {'l', 3},
            {'d', 14},
            {'r', 2},
            {'d', 20},
            {'w', 60},
            {'l', 2},
            {'d', 6},
            {'press_b', 4},
            {'w', 60},
            {'r', 1},
            {'press_b', 4},
            {'w', 60},
            {'r', 1},
            {'w', 60},
            {'press_b', 4},
            {'r', 1},
            {'w', 60},
            {'press_b', 4}, -- repel runs out (technically we only needed 2 :+)
            {'r', 4}, -- backtrack again 
            {'u', 2},
            {'r', 2},
            {'w', 360},
            {'u', 1},
            {'press_a', 1},
            {'press_b', 1},
            {'r', 3},
            {'d', 7},
            {'w', 180},
            {'d', 20},
            {'l', 37},
            {'d', 7},
            {'l', 6},
            {'u', 2},
            {'w', 540},
            {'pokecenter_heal', 1},
            {'d', 8},
            {'w', 720},
            {'r', 14},
            {'u', 7},
            {'r', 29},
            {'u', 20},
            {'l', 3},
            {'use_repel', 1},
            {'l', 7},
            {'u', 43},
            {'w', 60},
            {'r', 2},
            {'u', 11},
            {'l', 24},
            {'w', 60},
            {'u', 6},
            {'r', 6},
            {'w', 60},
            {'u', 1},
            {'w', 60},
            {'press_a', 3},
            {'press_b', 8},
            {'w', 900},
            {'use_move', 2},
            {'press_b', 12},
            {'w', 60},
            {'r', 7},
            {'u', 3},
            {'w', 540},
            {'u', 3},
            {'r', 2},
            {'w', 60},
            {'press_a', 4}, -- heal
            {'press_b', 6},
            {'l', 2},
            {'d', 5},
            {'w', 540},
            {'r', 3},
            {'d', 14},
            {'r', 3},
            {'w', 60},
            {'press_a', 1},
            {'press_b', 7},
            {'d', 4},
            {'press_a', 3},
            {'w', 60},
            {'d', 1},
            {'press_b', 7},
            {'d', 2},
            {'w', 120},
            {'l', 5},
            {'d', 3},
            {'save', '09-BeforeLongWait'},

            {'w', 26524}, -- get ready
            {'press_b', 15},
            {'w', 600},
            {'use_move', 1},
            {'press_a', 1},
            {'r', 1},
            {'use_move', 2},
            {'press_b', 16},
            {'l', 3},
            {'u', 3},
            {'w', 60},
            {'press_a', 3},
            {'press_b', 7},
            {'l', 2},
            {'u', 1},
            {'w', 60},
            {'press_a', 4},
            {'press_b', 8},
            {'d', 4},
            {'l', 7},
            {'w', 60},
            {'press_a', 1},
            {'press_b', 7},
            {'r', 9},
            {'d', 6},
            {'r', 3},
            {'d', 5},
            {'w', 60},
            {'d', 2},
            {'l', 4},
            {'u', 3},
            {'w', 60},
            {'press_a', 1},
            {'press_b', 7},
            {'d', 9},
            {'r', 6},
            {'d', 5},
            {'w', 120},
            {'d', 20},
            {'l', 37},
            {'d', 7},
            {'l', 6},
            {'u', 2},
            {'w', 540},
            {'pokecenter_heal', 1},
            {'d', 8},
            {'w', 540},
            {'x', 15}, -- switch flame wheel to front
    {'w', 60},
    {'u', 1},
    {'w', 60},
    {'press_a', 1},
    {'w', 360},
    {'press_a', 2},
    {'w', 300},
    {'l', 2},
    {'w', 60},
    {'press_a', 1},
    {'w', 60},
    {'d', 1},
    {'press_a', 1},
    {'u', 1},
    {'press_a', 1},
    {'w', 60},
    {'press_b', 11},
    {'save', '10-BeforeCycling'},

    -- start cycle
    {'l', 5},
    {'d', 11},
    {'custom8', 4},
    {'custom9', 1},
    {'custom8', 4},
    {'custom9', 1},
    {'custom8', 4},
    {'custom9', 1},
    {'custom8', 4}, -- 16 fights // lowest 
    {'custom9', 1},
    {'custom6', 4}, 
    {'custom7', 1}, -- highest xp is now potentially cycling
    {'custom6', 4}, 
    {'custom7', 1}, -- highest xp is now guarenteed cycling // 24 total, need 32
    {'custom6', 4}, 
    {'custom7', 1},
    {'custom6', 4}, 
    {'custom7', 1}, -- min xp should be cycling now too;
    {'u', 2},
    {'d', 1},
    {'w', 30},
    {'a', 15},
    {'w', 360},
    {'a',  15}, 
    {'press_b', 12}, -- don't learn feint
    {'custom9', 1},
    {'custom10', 6},
    {'custom11', 4}, -- cycling on 
    {'u', 2},
    {'d', 1},
    {'w', 30},
    {'a', 15},
    {'w', 360},
    {'a',  15}, 
    {'w', 360},
    {'custom1', 1}, -- up
    {'u', 23}, -- align against house 
    {'w', 60},
    {'w', 60},
    {'d', 13},
    {'r', 5},
    {'u', 2},
    {'w', 540},
    {'pokecenter_heal', 1}, 
    {'d', 8}, 
    {'w', 540}, -- out of the pokecenter :)
    {'save', '11-AfterCycling'},

    {'r', 7}, -- go to mart
{'u', 10},
{'r', 3},
{'u', 2},
{'w', 540},
{'u', 5},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 360},
{'d', 9},
{'w', 30},
{'press_a', 1},
{'w', 360},
{'u', 4},
{'press_a', 1},
{'w', 360},
{'press_a', 1},
{'w', 180},
{'press_b', 13},
{'d', 5},
{'r', 2},
{'d', 1},
{'reset_start', 1},
{'press_b', 3},
{'w', 60},
{'x', 15},
{'w', 90},
{'u', 4},
{'press_b', 3},
{'l', 2},
{'d', 2},
{'w', 540},
{'d', 2},
{'r', 33},
{'u', 19},
{'l', 2},
{'w', 60},
{'use_repel', 1},
{'l', 8},
{'u', 46},
{'w', 60},
{'r', 2},
{'u', 9},
{'l', 18},
{'w', 60},
{'u', 5},
{'r', 4},
{'u', 17},
{'w', 540},
{'u', 1},
{'press_b', 26},
{'u', 1},
{'r', 4},
{'u', 2},
{'r', 5},
{'u', 9},
{'r', 5},
{'u', 3},
{'w', 60},
{'press_b', 5},
{'u', 5}, -- before fight 
{'w', 60}, -- before pachirisu fight // breakpoint
{'save', '12-BeforePachirisuFight'},

{'x', 15}, -- give cheri berry to monferno :)
{'w', 60},
{'press_a', 1},
{'w', 360},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'r', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'d', 2},
{'press_a', 1},
{'w', 180},
{'press_a', 1},
{'w', 60},
{'press_b', 12}, -- done berrying up 
{'u', 1},
-- Double battle w/ pachirisu
--      Lowest possible level is 29
--      Cheri berry required to prevent paralysis from spark
--      Pachirisu can either spark or charm
--          - charm lowers atk by 2 stages
--          - need to KO pachirisu on turn 2 or else we can get KOed
--              - For example:
--                 - Chansey KOs wurmple, beautifly comes out, gust crits us on turn 2
--                 - By turn 3 we get gusted again and die if we are still dealing with pachirisu
--      TURN 1:
--          - Flame wheel on pachirisu 100% -> 25% at lowest
--          - We can be charmed, sparked, poison sting, string shot
--              - Either poisoned, -1 speed
--              - Either damaged from spark (23% dmg) or charmed (-2 atk stages)
--          - Total damage, 23% from spark, 12.5% from poison, 5% from poison sting
--                  - Total 40% damage taken at most
--     TURN 2:
--          - Even while charmed, mach punch will deal at least 25% damage to pachirisu
--          - Wurmple could tackle crit us, or lower speed with string shot
--              - Either -2 speed, poisoned and -1 speed, or max damage and no speed loss
--          - Pachirisu KOed
--              - If pachirisu died turn 1, we just idle here
--          - Take 7% dmg from tackle, 12.5% from poison
--              - Total 40 + 7 + 12.5 = 60% damage taken
--      TURN 3:
--          - Beautifly could be out
--              - If we are -2 speed, beautifly could outspeed us
--                  - Doesn't matter, because if we got string shot twice, we DIDNT get poison stung
--                  - So we have health to spare
--          - Flame wheel on beautifly KOs
--          - Max damage taken:
--              - 60 + 12.5 = 72.5%
--          - If beautifly outspeed:
--              - 52% from beautifly, 23% from spark
--              - 75% total, but we can't be posioned in this case
--      TURN 4:
--          - Silicoon could be out
--          - Too slow to attack us, gets flame wheeled
--          - Max damage taken:
--              - 72.5 + 12.5 = 83%
--      Fight is over
{'w', 180},
{'press_b', 23},
{'w', 1080},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 2160},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 2160},
{'press_b', 8},
{'press_a', 1},
{'l', 1},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'press_a', 1},
{'w', 2160},
{'press_a', 2},
{'w', 60},
{'press_a', 1},
{'w', 1320},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_a', 1},
{'w', 1440},
{'press_b', 13}, -- fight over
{'save', '13-AfterPachirisuFight'},

{'u', 3},
{'r', 3},
{'u', 6},
{'w', 60},
{'press_a', 1}, -- grab paralyze heal
{'press_b', 5},
{'r', 2},
{'u', 2},
{'r', 10},
{'d', 6},
{'l', 2},
{'d', 3},
{'w', 60},
{'press_a', 1}, -- fight first abra guy
{'press_b', 6},
{'w', 1260},
{'use_move', 1}, -- flame wheel easy
{'w', 360},
{'press_b', 3},
{'r', 6},
{'d', 1},
{'w', 60},
{'press_a', 1}, -- fight second flame wheel guy
{'press_b', 6},
{'w', 1440},
{'use_move', 1}, -- flame wheel easy
{'press_b', 3},
{'l', 3},
{'d', 9},
{'r', 3},
{'d', 2},
{'w', 60},
{'x', 15}, -- use repel, reset start menu to items
{'w', 60},
{'press_a', 1},
{'w', 180},
{'l', 1},
{'w', 60},
{'l', 2},
{'w', 60},
{'l', 1},
{'w', 60},
{'l', 1},
{'w', 60},
{'press_a', 2},
{'w', 60},
{'press_b', 7},
{'d', 4},
{'r', 9},
{'u', 20},
{'r', 11},
{'d', 3},
{'r', 14},
{'u', 15},
{'l', 11},
{'u', 12},
{'r', 7},
{'w', 180},
{'press_b', 30}, -- right before leaving, get soothe bell
{'r', 4},
{'w', 60},
{'press_b', 4},
{'r', 1},
{'w', 720}, -- into eterna
{'save', '14-InEterna'},

{'r', 2},
{'d', 7},
{'r', 13},
{'d', 4},
{'r', 33},
{'d', 30},
{'r', 7},
{'w', 60},
{'press_a', 1},
{'press_b', 22}, -- talk to gardenia
{'r', 1},
{'u', 2},
{'w', 720}, -- into gym
{'u', 5},
{'r', 3},
{'w', 60},
{'press_a', 1},
{'press_b', 3},
{'w', 1080},
{'use_move', 2},
{'press_b', 21},
{'w', 1800},
{'l', 3},
{'u', 5},
{'w', 180},
{'u', 4},
{'r', 10},
{'d', 4},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_b', 6},
{'w', 1260},
{'use_move', 3},
{'w', 180},
{'press_b', 8},
{'w', 1080},
{'press_b', 9},
{'u', 4},
{'l', 15},
{'w', 60},
{'l', 3},
{'u', 6},
{'w', 60},
{'press_a', 1},
{'w', 60},
{'press_b', 4},
{'w', 1080},
{'use_move', 1},
{'w', 180},
{'press_b', 9},
{'w', 1620},
{'press_b', 13},
{'d', 6},
{'r', 10},
{'u', 4},
{'u', 1},
{'u', 1},
{'w', 60},
{'u', 3},
{'w', 60}, -- in front of gardenia
{'press_a', 1},
{'press_b', 14},
{'w', 1620},
{'use_move', 1},
{'w', 180},
{'use_move', 4},
{'press_b', 70},
{'w', 120}, -- battle over
{'save', '15-BeatGardenia'},

{'d', 5},
{'w', 60},
{'d', 19},
{'w', 540},
{'l', 6},
{'u', 7},
{'r', 11},
{'d', 1},
{'w', 60},
{'press_a', 1},
{'press_b', 10},
{'l', 13},
{'u', 28},
{'w', 540},
{'pokecenter_heal', 1},
{'d', 8},
{'w', 540},
{'l', 7},
{'u', 8},
{'r', 5},
{'w', 360},
{'press_b', 9},
{'w', 720},
{'press_b', 51}, -- talk to rival
    {'u', 6},
    {'r', 4},
    {'press_a', 3}, -- pick up draco plate
    {'press_b', 15},
    {'l', 3},
    {'d', 4},
    {'l', 21},
    {'w', 600},
    {'press_b', 50}, -- talk to cynthia
    {'w', 300},
    {'l', 5},
{'d', 10}, -- go to berries
{'l', 16},
{'u', 6},
{'r', 2},
{'u', 4},
{'l', 5},
{'u', 5},
{'l', 2},
{'u', 2},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'press_a', 2},
{'press_b', 5},
{'l', 2},
{'u', 1},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'press_a', 2},
{'press_b', 10},
{'l', 2},
{'u', 1},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'press_a', 2},
{'press_b', 11},
{'l', 2},
{'u', 1},
{'w', 60},
{'press_a', 1},
{'w', 180},
{'press_a', 2},
{'press_b', 11}, -- done grabbing berries
{'r', 5},
{'d', 6},
{'r', 5},
{'d', 10},
{'l', 13},
{'u', 4},
{'l', 13},
{'u', 8},
{'l', 4},
{'w', 540},
{'l', 10},
{'d', 4},
{'use_repel', 1},
{'d', 9},
{'r', 9},
{'d', 15},
{'l', 8}, -- can't fight psyduck :(
    {'l', 3},
    {'d', 5},
    {'w', 60},
    {'press_a', 1},
    {'press_b', 5},
    {'w', 1200},
    {'use_move', 1}, -- defeat medatite 
    {'press_b', 6},
    {'u', 4},
    {'l', 13},
    {'d', 22},
    {'r', 4},
    {'w', 360},
    {'press_b', 5},
    {'w', 360},
    {'use_move', 3}, -- defeat wurmple/dustox/cascoon
    {'w', 180},
    {'press_b', 6}, -- get ready to fight burmy guy
    {'w', 1200}, -- they know protect :(
    {'use_move', 12}, 
    {'w', 90}, -- we're done here
    {'press_b', 5},
    {'r', 5},
    {'d', 3},
    {'r', 8},
    {'u', 3},
    {'r', 4},
    {'w', 120},
    {'press_b', 4},
    {'r', 1},
    {'use_repel', 1}, -- get potion
    {'r', 5},
    {'u', 2},
    {'w', 60},
    {'press_a', 1},
    {'press_b', 8},
    {'w', 60},
    {'u', 1},
    {'r', 3},
    {'u', 34},
    {'l', 10},
    {'u', 14},
    {'l', 5},
    {'u', 3},
    {'w', 60},
    {'press_a', 1},
    {'press_b', 24}, -- talk to gardenia
    {'r', 12},
    {'d', 3},
    {'r', 4},
    {'w', 720}, -- back out of eterna forest
    {'r', 3},
    {'d', 8},
    {'r', 6},
    {'w', 180},
    {'press_b', 4},
    {'r', 6},
    {'d', 4},
    {'r', 9},
    {'d', 8},
    {'l', 7},
    {'w', 60},
    {'press_a', 1}, -- get the guard spec
    {'w', 120},
    {'press_b', 8},
    {'r', 11},
    {'u', 8},
    {'r', 21},
    {'u', 5},
    {'w', 540},
    {'pokecenter_heal', 1}, -- heal/restore pp
    {'d', 8},
    {'w', 540},
    {'l', 6},
    {'u', 7},
    {'r', 17},
    {'u', 5},
    {'w', 540}, -- into herb shop
    {'l', 2},
    {'u', 3},
    {'w', 60},
    {'press_a', 1},
    {'w', 240},
    {'press_a', 1},
    {'w', 240},
    {'d', 2},
    {'w', 60},
    {'press_a', 1},
    {'w', 360},
    {'u', 2},
    {'w', 60},
    {'press_a', 1},
    {'w', 360},
    {'press_a', 1},
    {'w', 180},
    {'press_b', 11},
    {'r', 2},
    {'d', 4},
    {'w', 540},
    {'save', '16-DoneShopping'},

    {'d', 2}, -- to route 209
    {'r', 10},
    {'d', 9},
    {'r', 29},
    {'w', 60},
    {'use_repel', 1}, -- go through grass to fight ninja boy
    {'r', 8},
    {'u', 7},
    {'w', 180},
    {'press_b', 6},
    {'w', 1260},
    {'use_move', 3}, -- level up to 32
    {'press_b', 17},
    {'use_move', 1},
    {'press_b', 8},
    {'w', 540},
    {'d', 7},
    {'r', 17},
    {'w', 1720}, -- wait for rock man to notice us
    {'press_a', 1},
    {'press_b', 11},
    {'w', 720},
    {'press_a', 1},
    {'r', 1},
    {'use_move', 3}, -- destroy him// take damage from onix
    {'press_b', 8},
    {'r', 2},
    {'u', 5},
    {'r', 2},
    {'u', 1},
    {'press_a', 5}, -- rock smashu
    {'press_b', 12},
    {'u', 3},
    {'l', 13},
    {'w', 540},
    {'press_b', 22}, -- bird lady
    {'w', 900},
    {'use_move', 2}, -- ohko
    {'press_b', 5},
    {'d', 8},
    {'r', 2},
    {'d', 3},
    {'w', 60},
    {'press_a', 1}, -- get taunt tm
    {'press_b', 11},
    {'u', 3},
    {'l', 2},
    {'u', 8},
    {'r', 13},
    {'d', 5},
    {'l', 2},
    {'d', 6},
    {'l', 2},
    {'u', 2},
    {'l', 2},
    {'w', 180},
    {'press_b', 8}, -- repel runs out
    {'l', 1},
    {'w', 180},
    {'press_b', 8}, -- if rock boy saw us on step
    {'l', 12},
    {'use_repel', 1},
    {'l', 44}, -- back to eterna
    {'u', 5},
    {'l', 4},
    {'u', 5},
    {'l', 17},
    {'d', 9},
    {'r', 5},
    {'d', 17},
    {'r', 5},
    {'w', 180},
    {'press_b', 4}, -- repel runs out again
    {'r', 4},
    {'u', 2},
    {'w', 540}, -- into the mart
    {'u', 4},
    {'w', 60},
    {'press_a', 1}, -- buy repels tyty
    {'w', 180},
    {'press_a', 1},
    {'w', 360},
    {'u', 1},
    {'d', 1},
    {'w', 60},
    {'d', 1},
    {'w', 60},
    {'d', 1},
    {'w', 60},
    {'d', 1},
    {'w', 60},
    {'d', 1},
    {'w', 60},
    {'d', 1},
    {'w', 60},
    {'d', 1},
    {'w', 60},
    {'d', 1},
    {'w', 60},
    {'d', 1},
    {'w', 60},
    {'press_a', 1},
    {'w', 180},
    {'u', 4},
    {'press_a', 1},
    {'w', 240},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 1},
    {'w', 60},
    {'u', 6},
    {'press_a', 1},
    {'w', 180},
    {'u', 2},
    {'w', 60},
    {'press_a', 1},
    {'w', 240},
    {'press_a', 1},
    {'w', 180},
    {'press_b', 9}, -- bought 5 repels and 3 antidotes
    {'d', 6},
    {'w', 540},
    {'l', 4},
    {'u', 16},
    {'l', 2},
    {'u', 5},
    {'w', 720},
    {'pokecenter_heal', 1}, -- heal
    {'d', 8},
    {'w', 540},


    {'x', 15}, -- teach monferno cut
    {'w', 60},
    {'press_a', 1},
    {'w', 360},
    {'r', 1},
    {'w', 60},
    {'r', 1},
    {'w', 60},
    {'r', 1},
    {'w', 60},
    {'d', 6},
    {'w', 60},
    {'u', 2},
    {'w', 60},
    {'press_a', 1},
    {'w', 60},
    {'press_a', 1},
    {'w', 240},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 1},
    {'w', 360},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 1},
    {'d', 1},
    {'press_a', 1},
    {'w', 180},
    {'press_b', 18},
        -- go to galactic building
        {'l', 6},
        {'u', 9},
        {'r', 6},
        {'u', 2},
        {'w', 180},
        {'press_a', 1}, -- use cut
        {'w', 240},
        {'press_a', 1},
        {'w', 180},
        {'press_b', 8},
        {'w', 360},
        {'u', 3},
        {'w', 540}, -- enter
        {'press_b', 32}, -- talk to looker
        {'u', 2}, -- go fight double trainers one at a time
        {'r', 2},
        {'u', 6},
        {'w', 60},
        {'press_a', 1}, -- fight first guy
        {'w', 60},
        {'press_b', 10},
        {'w', 900},
        {'press_a', 1},
        {'use_move', 2}, -- double OHKO
        {'press_b', 6},
        {'r', 5},
        {'u', 1},
        {'w', 60},
        {'press_a', 1}, -- fight second guy
        {'w', 60},
        {'press_b', 7},
        {'w', 900},
        {'use_move', 2}, -- double OHKO
        {'w', 180},
        {'l', 3}, -- go up stairs
        {'u', 4},
        {'l', 2},
        {'w', 540},
        {'d', 3},
        {'w', 180},
        {'press_a', 1}, -- fight loser trainer 
        {'press_b', 7},
        {'w', 1080},
        {'use_move', 1}, -- croagunk dies instantly
        {'press_b', 4},
        {'l', 2},
        {'d', 3},
        {'r', 2},
        {'d', 5},
        {'w', 60},
        {'press_a', 1}, -- pick up XSPEED (X SPEED / X-SPEED) 
        {'press_b', 10},
        {'u', 5},
        {'l', 2},
        {'u', 5},
        {'r', 3}, -- back down the stairs 
        {'w', 540},
        {'d', 8},
        {'r', 7},
        {'u', 8},
        {'l', 2}, -- up the right stairs
        {'w', 540},
        -- breakpoint
        {'d', 3}, -- go to wrong stairs
        {'r', 2},
        {'d', 5},
        {'l', 2},
        {'d', 4},
        {'r', 14},
        {'u', 10},
        {'l', 4},
        {'w', 540},
        {'d', 3}, -- talk to trainer
        {'w', 360},
        {'press_b', 9},
        {'w', 1080},
        {'use_move', 2},
        {'press_b', 28}, -- hit level 33 (jupiter has no chance)
        {'use_move', 2}, -- might get fake-out'd by the lvl 16 glameow 
        {'press_b', 7},
        {'l', 2},
        {'d', 5},
        {'r', 3},
        {'w', 60},
        {'press_a', 1}, -- grab xspecial (x special x-special)
        {'press_b', 8},
        {'l', 3}, -- back down the stairs
        {'u', 6},
        {'r', 3},
        {'w', 540},
        {'d', 10},
        {'l', 7},
        {'u', 5},
        {'l', 1},
        {'w', 60},
        {'press_a', 1}, -- fight trainer
        {'press_b', 11},
        {'w', 1080},
        {'use_move', 1}, -- KO glameow lvl 19 
        {'press_b', 10},
        {'u', 6},
        {'l', 2},
        {'w', 720}, -- go upstairs
        {'d', 9},
        {'r', 18},
        {'u', 7},
        {'w', 180},
        {'press_b', 10}, -- fight kadabra guy
        {'w', 1080},
        {'use_move', 2}, -- gg
        {'press_b', 7},
        {'d', 7},
        {'l', 6},
        {'u', 9},
        {'l', 2}, -- go up stairs
        {'w', 540}, -- enter final floor
        {'d', 10}, -- go to jupiter
        {'r', 13},
        {'u', 7},
        {'l', 1},
        {'w', 30}, -- wait by jupiter
        {'save', '17-BeforeJupiter'},

        {'x', 15}, -- switch oran berry on (we might have a cheri berry still on monferno)
        {'w', 60},
        {'u', 1},
        {'w', 30},
        {'press_a', 1},
        {'w', 180},
        {'press_a', 1},
        {'w', 60},
        {'d', 4},
        {'press_a', 2},
        {'w', 360},
        {'r', 1},
        {'w', 60},
        {'d', 3},
        {'w', 60},
        {'press_a', 1},
        {'w', 180},
        {'press_a', 12}, -- give monferno oran berry (log this in item tracker)
        {'press_b', 10},
        {'x', 15}, -- use potion in case we got fake-out by glameow (time save, no pokecenter backtrack)
        {'w', 60},
        {'d', 1},
        {'press_a', 1}, 
        {'w', 540},
        {'l', 2},
        {'w', 60},
        {'l', 1},
        {'w', 60},
        {'l', 2},
        {'w', 60},
        {'press_a', 2},
        {'w', 180},
        {'press_a', 2},
        {'press_b', 9}, -- done using potion (track potion use in tracker)
        {'press_a', 1}, -- fight jupiter
        {'w', 60},
        {'press_b', 12}, 
        {'w', 900}, -- jupiter fight begins
    -- Lowest hp -> 10 // Seed: 1303324 Calm nature Monferno lvl 33
    -- zubat (21) is KOed in 1 hit by lvl 33 monferno flame wheel regardless of stats
        -- lvl 32 monferno does NOT OHKO zubat, which opens us up to wing attack
        -- super effective wing attack basically makes the fight unwinnable at 32
    -- Ineffective strategies 
        -- Pecha berry opens up gentle (-def) monfernos to a triple crit death even with energy root
        -- Taunt opens us up to fourth turn accuracy decrease (smokescreen) which makes us lose
            -- only way to avoid is heal stalling which would cost too much money
        -- Guard spec but no heal and we die to poison + crits
    -- Effective strategy
        -- Use Guard spec on first turn vs skuntank
        -- Attack twice
        -- heal with energy root
        -- attack twice more 
            -- effective health of skuntank is 103 with the sitrus berry
            -- flame wheel on low-atk monferno deals 31 dmg, low-def deals 34
            -- needs 4 turns to KO either way in worst case (which happens in quite a few seeds)
    {'press_a', 1},
    {'use_move', 1},
    {'press_b', 3},
    {'d', 1},
    {'press_a', 1},
    {'w', 60},
    {'r', 1},
    {'d', 1},
    {'press_a', 1},
    {'w', 60},
    {'r', 1},
    {'w', 60},
    {'press_a', 2},
    {'u', 1},
    {'w', 1440},
    {'u', 1},
    {'use_move', 2},
    {'d', 1},
    {'press_a', 1},
    {'w', 60},
    {'u', 1},
    {'l', 1},
    {'press_a', 1},
    {'w', 60},
    {'d', 1},
    {'press_a', 1},
    {'w', 60},
    {'press_a', 1},
    {'use_move', 1},
    {'press_b', 21},
    {'u', 1},
    {'w', 1260},
    {'u', 1},
    {'use_move', 2},
    {'press_b', 40},
    -- fight over, use an antidote just in case
    {'x', 15},
    {'w', 30},
    {'press_a', 1},
    {'w', 360},
    {'u', 1},
    {'d', 5},
    {'press_a', 2},
    {'w', 180},
    {'press_a', 1},
    {'w', 60},
    {'press_a', 2},
    {'w', 60},
    {'press_a', 1},
    {'press_b', 10},
    -- done using antidote
        -- go get the other items
        {'u', 5},
        {'w', 60},
        {'d', 3},
        {'r', 6},
        {'w', 60},
        {'press_a', 1},
        {'press_b', 9},
        {'l', 7},
        {'d', 8},
        {'l', 12},
        {'u', 10},
        {'r', 2},
        {'w', 540},
        {'d', 9},
        {'r', 7},
        {'u', 9},
        {'l', 2},
        {'w', 540},
        {'d', 3},
        {'w', 60},
        {'press_a', 1}, -- blue shard
        {'press_b', 8},
        {'r', 2},
        {'d', 1},
        {'w', 60},
        {'press_a', 1}, -- revive
        {'press_b', 8},
        -- items acquired, time to leave
        {'l', 2},
        {'u', 3},
        {'r', 2},
        {'w', 540},
        {'d', 9},
        {'l', 19},
        {'u', 9},
        {'r', 2},
        {'w', 540},
        {'d', 10},
        {'l', 7},
        {'u', 4},
        {'r', 2},
        {'u', 5},
        {'l', 2},
        {'u', 3},
        {'r', 2},
        {'w', 540},
        {'d', 8},
        {'l', 10},
        {'d', 4},
        {'w', 720}, -- outside of the galactic building
        {'save', '18-AfterJupiter'},

        {'r', 4}, -- go get thief TM
        {'u', 6},
        {'r', 5},
        {'w', 60},
        {'press_a', 1},
        {'w', 180},
        {'press_a', 3},
        {'press_b', 4},
        {'w', 60},
        {'r', 3},
        {'d', 2},
        {'r', 12},
        {'w', 60},
        {'press_a', 1}, -- acquired TM
        {'press_b', 9},
        {'l', 12},
        {'u', 2},
        {'l', 8},
        {'d', 6},
        {'l', 4},
        {'d', 1},
        {'w', 60},
        {'press_a', 4},
        {'press_b', 3}, -- back by galactic building
    {'w', 60},
    {'d', 5}, -- go to bike shop
    {'l', 5},
    {'d', 10},
    {'r', 6},
    {'d', 8},
    {'r', 3},
    {'w', 540},
    {'press_a', 13}, -- talk to cynthia
    {'press_b', 7},
    {'w', 180},
    {'r', 3},
    {'u', 3},
    {'w', 540},
    {'u', 4},
    {'l', 5},
    {'u', 2},
    {'w', 60},
    {'press_a', 1},
    {'press_b', 23}, -- acquire bike
    {'r', 5},
    {'d', 7},
    {'w', 540},
    {'d', 1},
    {'l', 5},
    {'u', 8},
    {'l', 2},
    {'u', 5},
    {'w', 540},
    {'pokecenter_heal', 1}, -- heal from jupiter fight
    -- togepi egg acquired, but it will hatch naturally exactly 2805 steps from now
    -- so we can just deal with it naturally, no need to worry about rng budding in
    {'d', 8}, -- out of center
    {'w', 540},
    {'d', 1},
    {'r', 6},
    {'u', 3},
    {'w', 540},
    {'r', 3},
    {'u', 3},
    {'press_a', 2},
    {'press_b', 32}, -- get explorer kit just to advance 
    {'l', 3},
    {'d', 4},
    {'w', 540},
    {'d', 2},
    {'l', 7},
    {'d', 32},
    {'l', 1},
    {'d', 7},
    {'w', 540},
    {'d', 1},
    {'l', 1},
    {'w', 60},
    {'press_a', 1},
    {'press_b', 24}, -- get EXP SHARE
    {'u', 3},
    {'w', 540}, -- go to eterna forest shortcut
    {'u', 36},
    {'l', 33},
    {'u', 4},
    {'l', 10},
    {'d', 7},
    {'l', 2},
    {'u', 4},
    {'l', 16},
    {'d', 7},
    {'w', 30},
    
    {'press_a', 1}, -- grab some berries and items
    {'w', 120},
    {'press_a', 1},
    {'w', 60},
    {'press_b', 8},
    {'d', 3},
    {'r', 3},
    {'d', 15},
    {'l', 17},
    {'u', 2},
    {'w', 60},
    {'press_a', 1},
    {'w', 60},
    {'press_a', 2},
    {'press_b', 6},
    {'l', 2},
    {'u', 1},
    {'w', 60},
    {'press_a', 3},
    {'press_b', 9},
    {'l', 2},
    {'u', 1},
    {'w', 60},
    {'press_a', 1},
    {'w', 60},
    {'press_a', 1},
    {'w', 60},
    {'press_a', 1},
    {'press_b', 8},
    {'l', 2},
    {'u', 1},
    {'w', 60},
    {'press_a', 1},
    {'w', 60},
    {'press_a', 2},
    {'press_b', 9},
    {'d', 2},
    {'r', 15},
    {'d', 6},
    {'l', 11},
    {'d', 11},
    {'l', 6},
    {'w', 60},
    {'press_a', 1},
    {'press_b', 7},
    {'r', 15},
    {'u', 2},
    {'w', 60},
    {'press_a', 1},
    {'press_b', 9},
    {'d', 2},
    {'l', 10},
    {'u', 10}, -- done grabbing items and berries
    {'r', 6}, -- back to eterna mart
    {'u', 2},
    {'r', 7},
    {'u', 6},
    {'r', 5},
    {'u', 14},
    {'l', 4},
    {'u', 3},
    {'r', 2},
    {'u', 10},
    {'r', 19},
    {'u', 2},
    {'r', 8},
    {'d', 4},
    {'r', 33},
    {'d', 16},
    {'r', 6},
    {'u', 2},
    {'w', 540}, -- enter mart
    
    {'u', 4}, -- buy 10 repels
    {'w', 60},
    {'press_a', 1},
    {'w', 60},
    {'press_a', 1},
    {'w', 180},
    {'d', 9},
    {'w', 60},
    {'press_a', 1},
    {'w', 180},
    {'u', 9},
    {'press_a', 1},
    {'w', 120},
    {'press_a', 1},
    {'w', 120},
    {'press_b', 11},
    
    {'l', 2}, -- buy 4 nest balls
    {'u', 1},
    {'w', 60},
    {'press_a', 1},
    {'w', 120},
    {'press_a', 1},
    {'w', 180},
    {'d', 3},
    {'w', 60},
    {'press_a', 1},
    {'w', 180},
    {'u', 3},
    {'w', 60},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 1},
    {'press_b', 9},
    {'r', 2},
    {'d', 6}, -- leave mart
    {'w', 360},

    {'l', 6}, -- go buy some energy roots
    {'u', 16},
    {'l', 6},
    {'u', 11},
    {'r', 18},
    {'u', 4},
    {'w', 540},
    {'l', 2},
    {'u', 3},
    {'w', 60},
    {'press_a', 1},
    {'w', 120},
    {'press_a', 1},
    {'w', 120},
    {'d', 2},
    {'w', 60},
    {'press_a', 1},
    {'w', 180},
    {'u', 4},
    {'press_a', 1},
    {'w', 180},
    {'press_a', 1},
    {'w', 60},
    {'press_b', 11}, -- bought 4 energy roots
    {'r', 2},
    {'d', 4},
    {'w', 540}, -- back outside in eterna
    -- 2097 steps left until togepi hatches
    {'d', 1},
    {'l', 16},
    {'d', 10},
    {'r', 6},
    {'u', 1},
    {'w', 60},
    {'press_a', 1},
    {'w', 120},
    {'press_a', 1},
    {'w', 60},
    {'r', 2},
    {'d', 3},
    {'r', 11},
    {'l', 1}, -- setup to start // 43 steps taken
    -- 2054 to go on 45 step intervals = ~46 cycles
    {'press_b', 1}, -- switch to higher gear
    {'run_daycare', 36}, -- hatch togepi
    {'save', '19-HatchedTogepi'},

    {'w', 60}, -- name togepi 
    {'press_a', 1},
    {'w', 1080},
    {'press_a', 1},
    {'w', 180},
    {'d', 1},
    {'r', 9},
    {'d', 1},
    {'press_a', 1},
    {'u', 2},
    {'l', 2},
    {'press_a', 1},
    {'d', 1},
    {'r', 4},
    {'press_a', 1},
    {'l', 3},
    {'d', 1},
    {'press_a', 1},
    {'l', 2},
    {'press_a', 1},
    {'l', 1},
    {'u', 1},
    {'l', 1},
    {'press_a', 1},
    {'d', 1},
    {'r', 8},
    {'press_a', 1},
    {'u', 2},
    {'r', 1},
    {'press_a', 1},
    {'w', 360}, -- done naming thomas
    {'rf', 500}, -- align against wall
    {'w', 60}, -- need to allow settling time
    {'l', 3}, -- leave eterna (for now)
    {'d', 3},
    {'w', 60},
    {'press_a', 2},
    {'w', 180},
    {'u', 5},
    {'l', 11},
    {'d', 39},
    {'w', 540}, -- enter entrance to bike route
    {'x', 15}, -- register bike to Y button
    {'w', 60},
    {'press_a', 1},
    {'w', 180},
    {'l', 1},
    {'w', 60},
    {'l', 2},
    {'w', 60},
    {'d', 5},
    {'press_a', 1},
    {'w', 60},
    {'d', 1},
    {'press_a', 1},
    {'press_b', 8},
    {'x', 15}, -- equip EXP share on thomas
    {'w', 60},
    {'u', 1},
    {'press_a', 1},
    {'w', 180},
    {'r', 1},
    {'press_a', 1},
    {'d', 2},
    {'press_a', 2},
    {'w', 180},
    {'r', 1},
    {'w', 60},
    {'d', 13},
    {'u', 2},
    {'press_a', 1},
    {'w', 60},
    {'press_b', 9}, -- done 
    {'y', 30}, -- equip bike
    {'d', 11}, -- shimmy into route 206
    {'w', 540},
    {'d', 16},

    {'l', 3},
    {'d', 2},
    {'w', 180},
    {'press_a', 1},
    {'press_b', 3},
    {'w', 1000},
    {'press_a', 1},
    {'use_move', 1},
    {'press_a', 40},
    {'uf', 240},
    {'press_a', 1},
    {'uf', 240}, -- staring at sign
    {'r', 1},
    {'w', 30},
    {'r', 2},
    {'u', 4},
    {'w', 540},
    {'u', 10},
    {'w', 540},
    {'y', 30}, -- off bike
    {'u', 36},
    {'r', 2},
    {'u', 4},
    {'w', 540},
    {'pokecenter_heal', 1}, -- heal
    {'d', 8},
    {'w', 540}, -- go back to bike route
    {'r', 1},
    {'w', 60},
    {'press_a', 1},
    {'w', 120},
    {'press_a', 1},
    {'w', 60},
    {'d', 40}, -- shimmy down
    {'w', 540},
    {'d', 10},
    {'w', 540},
    {'d', 16},
    {'d', 1},
    {'w', 180}, -- bike into guy
    {'press_a', 1},
    {'w', 60},
    {'press_a', 2},
    {'w', 900},
    {'press_a', 1},
    {'r', 1},
    {'d', 1},
    {'use_move', 2},
    {'w', 720},
    {'press_a', 6},
    {'w', 900},
    {'lf', 60},
    {'bike_slide', 10},
    {'lf', 300}, -- wait for her to see us (or we talked to her)
    {'bike_slide', 1}, -- retry, if we wait correct time (or close to it) it should work this time if we bumped the previous try
    {'press_a', 1}, -- fight starly girl
{'w', 60},
{'press_a', 1},
{'w', 1440},
{'use_move', 1}, -- level up togepi and monferno
{'press_b', 25}, -- get through prompts
{'use_move', 1},
{'press_b', 25},
{'use_move', 1},
{'w', 540}, -- finish fight
{'press_a', 2}, -- togepi levels up again
{'w', 1080}, -- let bike glide down to next trainer (bump)
{'uf', 360},
{'rf', 120},
{'uf', 360},
{'w', 30},
{'l', 2},
{'u', 3},
{'w', 360},
{'u', 12},
{'w', 540},
{'uf', 360},
{'w', 15},
{'y', 30}, -- unequip bike 
{'r', 2},
{'u', 2},
{'w', 540},
{'pokecenter_heal', 1},
{'d', 8},
{'w', 540},
{'d', 39},
{'w', 540},
{'y', 30}, -- equip bike
{'d', 3},

{'d', 7},
{'w', 540},
{'d', 2},
{'l', 5},
{'d', 16},
{'w', 1080}, -- in position vs next trainer
{'press_a', 1}, -- enter battle
{'w', 60},
{'press_a', 2},
{'w', 1260},
{'use_move', 1}, -- flame wheel the shinx (OHKO)
{'w', 1260}, -- gg biker man
{'lf', 60}, -- hug wall, gravity will take us next trainer
{'w', 300},
{'press_a', 1}, -- talk to her

{'w', 180},
{'press_a', 1},
{'w', 60},
{'press_a', 2},
{'w', 1080},
{'press_a', 1},
{'w', 60},
{'r', 1},
{'d', 1},
{'w', 60},
{'use_move', 2}, -- potential KO in one turn by crit but togepi level up prompt will eat inputs, so no worries
{'w', 120},
{'press_b', 12}, -- togepi levels up
{'w', 720},
{'press_a', 1},
{'w', 60},
{'u', 1},
{'l', 1},
{'w', 60},
{'use_move', 1},
{'w', 180},
{'press_a', 1}, -- togepi levels up again
{'w', 60},
{'press_a', 1},
{'w', 720},
{'rf', 120},
{'w', 300},
{'press_a', 1},
{'w', 1370},
{'use_move', 1}, -- defeat pikachu
{'w', 720},
{'lf', 120},
{'w', 90},
{'r', 3}, -- scoot over to exit
{'d', 2},
{'w', 540},
{'d', 12},
{'w', 540}, -- out of bike route
{'save', '21-OutOfBikeRoute'},

}

client.unpause()
client.unpause_av()

m.executeOrders(a)
client.pause_av()
client.pause()
