Created
November 17, 2023 18:33
-
-
Save alpha123/9c75f6357379c545ba923b2e1328654d 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 { RaceSolver } from '../RaceSolver'; | |
import { RaceSolverBuilder } from '../RaceSolverBuilder'; | |
import courses from '../data/course_data.json'; | |
import tracknames from '../data/tracknames.json'; | |
const G1TRACKS = ['11101', '10504', '10506', '10501', '11503', '11401', '11403', '10804', '11402', '10906', '11301', '10606', '11501', '10903', '10602', '10708', '11303', '10611', '10701', '11504', '10811', '10810', '11302', '10604', '10905', '11102', '10808', '11103', '10807', '11502']; | |
const doorbell = { | |
speed: 1600, | |
stamina: 800, | |
power: 1200, | |
guts: 800, | |
wisdom: 1200, | |
strategy: Strategy.Sasi, | |
distanceAptitude: Aptitude.S, | |
surfaceAptitude: Aptitude.A, | |
strategyAptitude: Aptitude.A | |
}; | |
Object.keys(courses).forEach(cid => { | |
//if (G1TRACKS.indexOf(cid) == -1) return; | |
const g1 = G1TRACKS.indexOf(cid) != -1; | |
const b0 = new RaceSolverBuilder(1) | |
.seed(1) | |
.course(+cid) | |
.horse(doorbell); | |
const b1 = b0.fork() | |
.addSkill('202711'); | |
const s0 = b0.build().next().value as RaceSolver; | |
const s1 = b1.build().next().value as RaceSolver; | |
let state = 0, carryover = false; | |
while (s1.pos < b1._course.distance) { | |
s1.step(1/15); | |
if (state == 0 && s1.phase == 1 && s1.activeTargetSpeedSkills.length > 0) { | |
state = 1; | |
} else if (state == 1 && s1.activeTargetSpeedSkills.length == 0) { | |
if (s1.pos >= CourseHelpers.phaseStart(b1._course.distance, 2) - 2.1) { | |
carryover = true; | |
} | |
state = 2; | |
} | |
} | |
while (s0.accumulatetime.t < s1.accumulatetime.t) { | |
s0.step(1/15); | |
} | |
const c = courses[cid]; | |
if (s1.pos != s0.pos) { | |
console.log((carryover ? '!' : '') + ' ' + (g1 ? '*' : '') + tracknames[c.raceTrackId][1] + ' ' + c.distance + (c.surface == 2 ? ' (dirt)' : '') + ',' + ((s1.pos - s0.pos) / 2.5).toFixed(2)); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment