Created
November 14, 2022 12:37
-
-
Save alpha123/8ac74ff4697d031607a6becc65b319d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { CourseHelpers } from '../CourseData'; | |
import { Strategy, Aptitude } from '../HorseTypes'; | |
import { Region } from '../Region'; | |
import { Rule30CARng } from '../Random'; | |
import { RaceSolver, SkillType, SkillRarity } from '../RaceSolver'; | |
const base = { | |
speed: 1400, | |
stamina: 800, | |
power: 1000, | |
guts: 600, | |
wisdom: 1000, | |
strategy: Strategy.Nige, | |
distanceAptitude: Aptitude.S, | |
surfaceAptitude: Aptitude.A, | |
strategyAptitude: Aptitude.A | |
}; | |
const runnerSkills = [{ | |
skillId: '201601', | |
rarity: SkillRarity.White, | |
trigger: new Region(0, 100), | |
extraCondition: (_) => true, | |
effects: [{type: SkillType.Accel, baseDuration: 3.0, modifier: 0.2}] | |
}, { | |
skillId: '200532', | |
rarity: SkillRarity.White, | |
trigger: new Region(0, 100), | |
extraCondition: (_) => true, | |
effects: [{type: SkillType.Accel, baseDuration: 1.2, modifier: 0.2}] | |
}]; | |
const course = CourseHelpers.getCourse(10808); | |
let powerLo = 1, powerHi = 1250; | |
const debufferSurfaceAptitude = Aptitude.A; | |
while (powerLo < powerHi) { | |
const powerUnderTest = Math.floor((powerLo + powerHi) / 2); | |
const rngR = new Rule30CARng(1), rngC = new Rule30CARng(1), rngD = new Rule30CARng(1), rngP1 = new Rule30CARng(1), rngP2 = new Rule30CARng(1); | |
const runner = new RaceSolver({horse: base, course, rng: rngR, skills: runnerSkills}); | |
const pacer1 = new RaceSolver({horse: base, course, rng: rngP1, skills: runnerSkills}); | |
const pacer2 = new RaceSolver({horse: base, course, rng: rngP2, skills: runnerSkills}); | |
const chaser = new RaceSolver({horse: Object.assign({}, base, {strategy: Strategy.Oikomi}), course, rng: rngC, pacer: pacer1, skills: []}); | |
const debuffer = new RaceSolver({ | |
horse: Object.assign({}, base, {power: powerUnderTest, strategy: Strategy.Oikomi, surfaceAptitude: debufferSurfaceAptitude}), | |
course, rng: rngD, pacer: pacer2, skills: [] | |
}); | |
let activatedSleepingLion = false; | |
console.log(powerLo + '/' + powerHi + ' => ' + powerUnderTest); | |
while (chaser.phase < 2) { | |
runner.step(1/15); | |
chaser.step(1/15); | |
debuffer.step(1/15); | |
if (chaser.phase == 1 && runner.pos - chaser.pos >= 0.75 * (runner.pos - debuffer.pos)) { | |
console.log(runner.accumulatetime.t + '; ' + runner.pos.toFixed(2) + ', ' + chaser.pos.toFixed(2) + ', ' + debuffer.pos.toFixed(2)); | |
activatedSleepingLion = true; | |
powerHi = powerUnderTest - 1; | |
break; | |
} | |
} | |
if (!activatedSleepingLion) { | |
if (powerLo == powerUnderTest) { | |
break; | |
} else { | |
powerLo = powerUnderTest; | |
} | |
} | |
} | |
console.log(powerLo + ', ' + powerHi); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment