def main(): ## build the damage function. build_linkedlist_better() # two backup copies of the function. copy(0, 1) copy(0, 2) ## step 1: kill their low-numberd slots. (high-numbered for us.) build_num_in_slot(254, 1) smash() for targetslot in range(254, 256): for i in range(LOOPS): ### put the unrolled fireball in slot 0. unsafe_copy(2, 0) ## pass the function a target slot number. smash() if targetslot != 255: apply_card("succ", 1) build_num_in_slot(250, 1) for targetslot in range(250, 254): for i in range(LOOPS): ### put the unrolled fireball in slot 0. unsafe_copy(2, 0) ## pass the function a target slot number. smash() if targetslot != 253: apply_card("succ", 1) ## just in case we've iterated over all the slots, try it twice. This ## should take us through the end of a game. for times in range(2): unsafe_copy(2, 0) copy(2, 1) ## now start working on slot 0, which is easy to attack. apply_slot(0, "zero") for i in range(LOOPS): unsafe_copy(1, 0) ## pass slot 0 a slot number. apply_slot(0, "zero") build_num_in_slot(0, 1) for targetslot in range(1, 256): apply_card("succ", 1) for i in range(LOOPS): ### put the unrolled fireball in slot 0. unsafe_copy(2, 0) ## pass the function a target slot number. smash() gameloop()
def main(): ## build the damage function. build_linkedlist_better() # two backup copies of the function. copy(0, 1) copy(0, 2) ## step 1: kill their low-numberd slots. (high-numbered for us.) build_num_in_slot(254,1) smash() for targetslot in range(254, 256): for i in range(LOOPS): ### put the unrolled fireball in slot 0. unsafe_copy(2,0) ## pass the function a target slot number. smash() if targetslot != 255: apply_card("succ", 1) build_num_in_slot(250,1) for targetslot in range(250, 254): for i in range(LOOPS): ### put the unrolled fireball in slot 0. unsafe_copy(2,0) ## pass the function a target slot number. smash() if targetslot != 253: apply_card("succ", 1) ## just in case we've iterated over all the slots, try it twice. This ## should take us through the end of a game. for times in range(2): unsafe_copy(2,0) copy(2,1) ## now start working on slot 0, which is easy to attack. apply_slot(0, "zero") for i in range(LOOPS): unsafe_copy(1,0) ## pass slot 0 a slot number. apply_slot(0, "zero") build_num_in_slot(0, 1) for targetslot in range(1, 256): apply_card("succ", 1) for i in range(LOOPS): ### put the unrolled fireball in slot 0. unsafe_copy(2,0) ## pass the function a target slot number. smash() gameloop()
def main(): ## This takes up slots 0,1 and also 5,6,7, but it puts the y combinator ## into slot 5. build_applicative_y(5) ## stomps registers [0,4]. Result is in 0. build_fireball() ## make 0 and 1 Y, fireball respectively copy(0, 1) copy(5, 0) ## combinate: now the combinated fireball is in 0. smash() ## make backup copies of the combinated fireball. copy(0, 1) copy(0, 2) ## pass slot 0 a slot number. apply_slot(0, "zero") for i in range(999): unsafe_copy(1, 0) ## pass slot 0 a slot number. apply_slot(0, "zero") build_num_in_slot(0, 1) ## really should be up to range 256, but we're not fast enough yet. for targetslot in range(1, 10): apply_card("succ", 1) for i in range(1000): ### put the combinated fireball in slot 0. unsafe_copy(2, 0) ## pass slot 0 a slot number. smash() gameloop()
def main(): ## This takes up slots 0,1 and also 5,6,7, but it puts the y combinator ## into slot 5. build_applicative_y(5) ## stomps registers [0,4]. Result is in 0. build_fireball() ## make 0 and 1 Y, fireball respectively copy(0,1) copy(5,0) ## combinate: now the combinated fireball is in 0. smash() ## make backup copies of the combinated fireball. copy(0,1) copy(0,2) ## pass slot 0 a slot number. apply_slot(0, "zero") for i in range(999): unsafe_copy(1,0) ## pass slot 0 a slot number. apply_slot(0, "zero") build_num_in_slot(0, 1) ## really should be up to range 256, but we're not fast enough yet. for targetslot in range(1, 10): apply_card("succ", 1) for i in range(1000): ### put the combinated fireball in slot 0. unsafe_copy(2,0) ## pass slot 0 a slot number. smash() gameloop()
def main(): build_onemore() copy(0, 2) ## back up the onemore for later use build_base(1) smash() copy(0, 1) ## move the now-bigger function into 1 ## build up a function that does 67 damage. That's the biggest one that we ## can run without going over the function application limit. for i in range(65): # copy the onemore into 0 copy(2, 0) smash() # copy the now-bigger function into 1 copy(0, 1) ## two backup copies of the 67-damage thing. copy(0, 2) ## step 1: kill their low-numbered slots. (high-numbered for us.) build_num_in_slot(253, 1) smash() for targetslot in range(253, 256): for i in range(LOOPS): ### put the unrolled fireball in slot 0. unsafe_copy(2, 0) ## pass the function a target slot number. smash() if targetslot != 255: apply_card("succ", 1) build_num_in_slot(250, 1) for targetslot in range(250, 253): for i in range(LOOPS): ### put the unrolled fireball in slot 0. unsafe_copy(2, 0) ## pass the function a target slot number. smash() if targetslot != 253: apply_card("succ", 1) unsafe_copy(2, 0) copy(2, 1) ## now start working on slot 0, which is easy to attack. apply_slot(0, "zero") for i in range(LOOPS): unsafe_copy(1, 0) ## pass slot 0 a slot number. apply_slot(0, "zero") build_num_in_slot(0, 1) ## really should be up to range 256. How fast are we? for targetslot in range(1, 100): apply_card("succ", 1) for i in range(LOOPS): ### put the unrolled fireball in slot 0. unsafe_copy(2, 0) ## pass the function a target slot number. smash() gameloop()
def main(): build_onemore() copy(0, 2) ## back up the onemore for later use build_base(1) smash() copy(0,1) ## move the now-bigger function into 1 ## build up a function that does 67 damage. That's the biggest one that we ## can run without going over the function application limit. for i in range(65): # copy the onemore into 0 copy(2,0) smash() # copy the now-bigger function into 1 copy(0,1) ## two backup copies of the 67-damage thing. copy(0,2) ## step 1: kill their low-numbered slots. (high-numbered for us.) build_num_in_slot(253,1) smash() for targetslot in range(253, 256): for i in range(LOOPS): ### put the unrolled fireball in slot 0. unsafe_copy(2,0) ## pass the function a target slot number. smash() if targetslot != 255: apply_card("succ", 1) build_num_in_slot(250,1) for targetslot in range(250, 253): for i in range(LOOPS): ### put the unrolled fireball in slot 0. unsafe_copy(2,0) ## pass the function a target slot number. smash() if targetslot != 253: apply_card("succ", 1) unsafe_copy(2,0) copy(2,1) ## now start working on slot 0, which is easy to attack. apply_slot(0, "zero") for i in range(LOOPS): unsafe_copy(1,0) ## pass slot 0 a slot number. apply_slot(0, "zero") build_num_in_slot(0, 1) ## really should be up to range 256. How fast are we? for targetslot in range(1, 100): apply_card("succ", 1) for i in range(LOOPS): ### put the unrolled fireball in slot 0. unsafe_copy(2,0) ## pass the function a target slot number. smash() gameloop()