comparison clojure/com/aurellem/run/bootstrap_0.clj @ 331:6ec288064d49

improved do-save-corruption
author Robert McIntyre <rlm@mit.edu>
date Fri, 06 Apr 2012 12:18:58 -0500
parents ecff37d22293
children 5c2041d1cdda
comparison
equal deleted inserted replaced
330:ecff37d22293 331:6ec288064d49
416 script 416 script
417 (range (Math/abs best-path))))) 417 (range (Math/abs best-path)))))
418 ([desired-quantity [moves state :as script]] 418 ([desired-quantity [moves state :as script]]
419 (set-quantity 99 desired-quantity script))) 419 (set-quantity 99 desired-quantity script)))
420 420
421 (defn activate-start-menu [script]
422 (first-difference [:b] [:b :start] AF script))
423
421 (defn-memo do-save-corruption 424 (defn-memo do-save-corruption
422 ([] (do-save-corruption 425 ([] (do-save-corruption
423 (walk-to-counter))) 426 (walk-to-counter)))
424 ([script] 427 ([script]
425 (->> script 428 (->> script
426 (first-difference [] [:start] AF) 429 activate-start-menu
427 (set-cursor 4) 430 (set-cursor 4)
428 (do-nothing 5) 431 select-menu-entry
429 (play-moves [[:a]]) 432 select-menu-entry
430 (play-moves (repeat 85 [:b]))
431 (play-moves [[:a]])
432 (play-moves 433 (play-moves
433 ;; this section is copied from speedrun-2942 and corrupts 434 ;; this section is copied from speedrun-2942 and corrupts
434 ;; the save so that the total number of pokemon is set to 435 ;; the save so that the total number of pokemon is set to
435 ;; 0xFF, allowing manipulation of non-pokemon data in RAM 436 ;; 0xFF, allowing manipulation of non-pokemon data in RAM
436 ;; via the pokemon interface. 437 ;; via the pokemon interface.
483 (first-difference [] [:a] AF) 484 (first-difference [] [:a] AF)
484 scroll-text 485 scroll-text
485 select-menu-entry 486 select-menu-entry
486 scroll-text)) 487 scroll-text))
487 488
488 (defn activate-start-menu [script]
489 (first-difference [:b] [:b :start] AF script))
490
491 (defn-memo corrupt-item-list 489 (defn-memo corrupt-item-list
492 "Corrupt the num-of-items variable by switching a corrupted pokemon 490 "Corrupt the num-of-items variable by switching a corrupted pokemon
493 into out-of-bounds memory." 491 into out-of-bounds memory."
494 ([] (corrupt-item-list 492 ([] (corrupt-item-list
495 (corrupted-checkpoint))) 493 ;;(corrupted-checkpoint)
494 (do-save-corruption)
495 ))
496 ([script] 496 ([script]
497 (->> script 497 (->> script
498 activate-start-menu 498 activate-start-menu
499 (set-cursor 1) ; select "POKEMON" from 499 (set-cursor 1) ; select "POKEMON" from
500 select-menu-entry ; from main menu. 500 select-menu-entry ; from main menu.
554 close-menu ; stop talking to shopkeep 554 close-menu ; stop talking to shopkeep
555 (wait-until select-menu-entry) 555 (wait-until select-menu-entry)
556 (play-moves [[:b]]) 556 (play-moves [[:b]])
557 end-text))) 557 end-text)))
558 558
559 (defn corrupt-item-list-again 559 (defn-memo corrupt-item-list-again
560 ([] (corrupt-item-list-again (buy-bootstrapping-items))) 560 ([] (corrupt-item-list-again (buy-bootstrapping-items)))
561 ([script] 561 ([script]
562 (->> script 562 (->> script
563
564 activate-start-menu 563 activate-start-menu
565 (set-cursor-relative 0) 564 (set-cursor-relative 0)
566 select-menu-entry 565 select-menu-entry
567 566
568 ;; repair list-offset for pokemon-list 567 ;; repair list-offset for pokemon-list
569 (set-cursor-relative -1) 568 (set-cursor-relative -1)
570 569
571
572 (set-cursor 4) ; switching it to 570 (set-cursor 4) ; switching it to
573 select-menu-entry ; tenth place. 571 select-menu-entry ; tenth place.
574 (set-cursor 1) 572 (set-cursor 1)
575 select-menu-entry ; select "switch" on 5th 573 select-menu-entry ; select "switch" on 5th
576 574
577 (repeat-until-different [] list-offset) 575 (repeat-until-different [] list-offset)
578 (set-cursor 9) ; goto 10th pokemon 576 (set-cursor 9) ; goto 10th pokemon
579 select-menu-entry ; do switch 577 select-menu-entry ; do switch
580 close-menu 578 close-menu
581 close-menu 579 close-menu)))
582
583 (do-nothing 1)
584 ;;select-menu-entry
585 ;;
586 ;;(set-cursor 9)
587 ;;select-menu-entry
588 ;;close-menu
589
590 )))
591 ;; (do-nothing 10)
592 ;; (play-moves [[:b]])
593 ;; (do-nothing 100)
594 ;; (play-moves [[:b]])
595 ;; (do-nothing 40)
596 ;; (play-moves [[:b]])
597 ;; (first-difference [:b] [:start :b] AF)
598 ;; (menu [[:a] ↑ ↑ ↑ ↑ ↑
599 ;; [:a] ↓ [:a]
600 ;; ↓ ↓ ↓ ↓ ↓ [:a]])
601 ;;
602 ;; )))
603 580
604 (defn-memo viridian-store->viridian-poke-center 581 (defn-memo viridian-store->viridian-poke-center
605 ([] (viridian-store->viridian-poke-center 582 ([] (viridian-store->viridian-poke-center
606 (corrupt-item-list-again))) 583 (corrupt-item-list-again)))
607 ([script] 584 ([script]
608 (->> script 585 (->> script
609 (do-nothing 100)
610 (play-moves [[:b]])
611 (do-nothing 100)
612 (play-moves [[:b]])
613 (do-nothing 40)
614 ;; leave store 586 ;; leave store
615 (walk [↓ ↓ 587 (walk [↓ ↓
616 → ↓ ↓]) 588 → ↓ ↓])
617 (walk [← ← ← ← 589 (walk [← ← ←
618 ↓ ↓ ↓ ↓ ↓ ↓ 590 ↓ ↓ ↓ ↓ ↓
619 ← ← ← ↑])))) 591 ← ← ← ↑]))))
620 592
621 (defn-memo to-poke-center-computer 593 (defn-memo to-poke-center-computer
622 ([] (to-poke-center-computer 594 ([] (to-poke-center-computer
623 (viridian-store->viridian-poke-center))) 595 (viridian-store->viridian-poke-center)))
624 ([script] 596 ([script]
625 (->> script 597 (->> script
626 (walk [→ → 598 (walk [→ →
627 ↑ ↑ ↑ 599 ↑ ↑ ↑
628 → → → → → → → → → ↑]) 600 → → → → → → → → →])
629 (do-nothing 1)))) 601 (do-nothing 1))))
630 602
631 (defn-memo begin-deposits 603 (defn-memo begin-deposits
632 ([] (begin-deposits 604 ([] (begin-deposits
633 (to-poke-center-computer))) 605 (to-poke-center-computer)))