/** Poll RNG from the RNG manager. */ protected int PollRNG() { //StringUtilities.WriteLine("RNG => " + this); return(_rng.PollRNG()); }
// Given frame 1, goes forward and spawns wall push swings to investigate // Frame 1 is the frame at the start of the pendulum swing that lets Mario get the right height public void FindIdealReentryManipulationGivenFrame1(List <int> dustFrames, int frame1) { //Config.Print("TRY\t{0}\t{1}", frame1, "[" + string.Join(",", dustFrames) + "]"); int phase2Limit = 1000; TtcPendulum pendulum = GetReentryPendulum(); TtcBobomb firstBobomb = GetFirstBobomb(); TtcBobomb secondBobomb = GetSecondBobomb(); TtcBobomb thirdBobomb = null; TtcBobomb fourthBobomb = null; int counter = 0; int frame = _startingFrame; while (frame < _startingFrame + phase2Limit) { counter++; frame++; foreach (TtcObject rngObject in _rngObjects) { // coin for bobomb 1 if (counter == 162 && rngObject == firstBobomb) { _rng.PollRNG(3); } // coin for bobomb 2 if (counter == 258 && rngObject == secondBobomb) { _rng.PollRNG(3); } rngObject.SetFrame(frame); rngObject.Update(); } // bob-omb 2 start if (counter == 19) { secondBobomb.SetWithinMarioRange(1); } // bob-omb 2 end, bob-omb 4 start if (counter == 258) { _rngObjects.Remove(secondBobomb); fourthBobomb = new TtcBobomb(_rng, 0, 0); // starts outside range _rngObjects.Insert(68, fourthBobomb); } // bob-omb 1 start if (counter == 154) { firstBobomb.SetWithinMarioRange(1); } // bob-omb 1 end, bob-omb 3 start if (counter == 162) { _rngObjects.Remove(firstBobomb); thirdBobomb = new TtcBobomb(_rng, 0, 1); // starts inside range _rngObjects.Insert(68, thirdBobomb); } // bob-omb 3 exiting range if (counter == 363) { thirdBobomb.SetWithinMarioRange(0); } // dust frames if (counter >= 84 && counter <= 95 && counter != 93) { _rng.PollRNG(4); } // bob-omb 2 fuse smoke if ((counter >= 99 && counter <= 211 && counter % 8 == 3) || (counter >= 219 && counter <= 257 && counter % 2 == 1)) { _rng.PollRNG(3); } // bob-omb 1 fuse smoke if (counter >= 156 && counter <= 162 && counter % 2 == 0) { _rng.PollRNG(3); } // pendulum must have enough waiting frames if (counter == 162) { bool pendulumQualifies = pendulum._waitingTimer >= 18; if (!pendulumQualifies) { return; } } // Check if pendulum will do wall push swing if (counter > 363 + 15 && pendulum._accelerationDirection == -1 && pendulum._accelerationMagnitude == 42 && pendulum._angularVelocity == 0 && pendulum._waitingTimer == 0 && pendulum._angle == 42748) { TtcSimulation simulation = new TtcSimulation(GetSaveState(), frame, new List <int>()); simulation.FindIdealReentryManipulationGivenFrame2(dustFrames, frame1, frame); } //Config.Print(frame + "\t" + _rng.GetIndex() + "\t" + GetSaveState()); } }