mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-29 01:13:53 +03:00
make the prebaking a little more flexible; cut off lakeslice at noon for now
This commit is contained in:
parent
ed5b35ffd9
commit
7dd392b27f
@ -195,6 +195,7 @@ data/system/maps/intl_district.bin,34c5066b283097d566b0bb9353eb46e0,https://www.
|
||||
data/system/maps/lakeslice.bin,9e62897dbba17bc02e06ea58f678511e,https://www.dropbox.com/s/99zi0gcbyvqrkud/lakeslice.bin.zip?dl=0
|
||||
data/system/maps/montlake.bin,79d0baf716f3310aea2e4ac5663f3f7e,https://www.dropbox.com/s/zvhm2j5lavixxcr/montlake.bin.zip?dl=0
|
||||
data/system/maps/west_seattle.bin,b44ecbf25220713524d7e76f3c67ba92,https://www.dropbox.com/s/5pp1ik9l40yj3wh/west_seattle.bin.zip?dl=0
|
||||
data/system/prebaked_results/lakeslice/weekday.bin,e6ae8e6cce4f485e20c4333001c2f0bf,https://www.dropbox.com/s/1c1sohvy50263wg/weekday.bin.zip?dl=0
|
||||
data/system/prebaked_results/montlake/car vs bike contention.bin,1031311cb5f27dcda4a92083cc0c214f,https://www.dropbox.com/s/jefg0ikjy9dsrdd/car%20vs%20bike%20contention.bin.zip?dl=0
|
||||
data/system/prebaked_results/montlake/weekday.bin,30033ba544b2bd9810aa7278ee380ec2,https://www.dropbox.com/s/1aq7n9ow8tfqb5d/weekday.bin.zip?dl=0
|
||||
data/system/scenarios/23rd/weekday.bin,54f584d2116a7d388db6aff41770167f,https://www.dropbox.com/s/tgo7gztfodbljyi/weekday.bin.zip?dl=0
|
||||
|
@ -292,6 +292,35 @@ impl Tab {
|
||||
pub fn prebake_all() {
|
||||
let mut timer = Timer::new("prebake all challenge results");
|
||||
|
||||
{
|
||||
let map = map_model::Map::new(abstutil::path_map("montlake"), false, &mut timer);
|
||||
let scenario: Scenario =
|
||||
abstutil::read_binary(abstutil::path_scenario("montlake", "weekday"), &mut timer);
|
||||
prebake(&map, scenario, None, &mut timer);
|
||||
|
||||
for generator in TutorialState::scenarios_to_prebake(&map) {
|
||||
let scenario = generator.generate(
|
||||
&map,
|
||||
&mut SimFlags::for_test("prebaked").make_rng(),
|
||||
&mut timer,
|
||||
);
|
||||
prebake(&map, scenario, None, &mut timer);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
let map = map_model::Map::new(abstutil::path_map("lakeslice"), false, &mut timer);
|
||||
let scenario: Scenario =
|
||||
abstutil::read_binary(abstutil::path_scenario("lakeslice", "weekday"), &mut timer);
|
||||
prebake(&map, scenario, Some(Duration::hours(12)), &mut timer);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO This variant will be more useful when all scenarios tend to actually complete. ;)
|
||||
#[allow(unused)]
|
||||
pub fn generic_prebake_all() {
|
||||
let mut timer = Timer::new("prebake all challenge results");
|
||||
|
||||
let mut per_map: BTreeMap<String, Vec<Challenge>> = BTreeMap::new();
|
||||
for (_, list) in Challenge::all(true) {
|
||||
for c in list {
|
||||
@ -302,10 +331,6 @@ pub fn prebake_all() {
|
||||
}
|
||||
}
|
||||
for (map_path, list) in per_map {
|
||||
// TODO Oops can't do this yet.
|
||||
if map_path == abstutil::path_map("downtown") {
|
||||
continue;
|
||||
}
|
||||
timer.start(format!("prebake for {}", map_path));
|
||||
let map = map_model::Map::new(map_path.clone(), false, &mut timer);
|
||||
|
||||
@ -323,7 +348,7 @@ pub fn prebake_all() {
|
||||
}
|
||||
done_scenarios.insert(scenario.scenario_name.clone());
|
||||
|
||||
prebake(&map, scenario, &mut timer);
|
||||
prebake(&map, scenario, None, &mut timer);
|
||||
}
|
||||
}
|
||||
// TODO A weird hack to glue up tutorial scenarios.
|
||||
@ -334,23 +359,15 @@ pub fn prebake_all() {
|
||||
&mut SimFlags::for_test("prebaked").make_rng(),
|
||||
&mut timer,
|
||||
);
|
||||
prebake(&map, scenario, &mut timer);
|
||||
prebake(&map, scenario, None, &mut timer);
|
||||
}
|
||||
}
|
||||
|
||||
timer.stop(format!("prebake for {}", map_path));
|
||||
}
|
||||
|
||||
// TODO No challenge here yet, but still want the data
|
||||
{
|
||||
let map = map_model::Map::new(abstutil::path_map("lakeslice"), false, &mut timer);
|
||||
let scenario: Scenario =
|
||||
abstutil::read_binary(abstutil::path_scenario("lakeslice", "weekday"), &mut timer);
|
||||
prebake(&map, scenario, &mut timer);
|
||||
}
|
||||
}
|
||||
|
||||
fn prebake(map: &Map, scenario: Scenario, timer: &mut Timer) {
|
||||
fn prebake(map: &Map, scenario: Scenario, time_limit: Option<Duration>, timer: &mut Timer) {
|
||||
timer.start(format!(
|
||||
"prebake for {} / {}",
|
||||
scenario.map_name, scenario.scenario_name
|
||||
@ -362,7 +379,11 @@ fn prebake(map: &Map, scenario: Scenario, timer: &mut Timer) {
|
||||
// Bit of an abuse of this, but just need to fix the rng seed.
|
||||
let mut rng = SimFlags::for_test("prebaked").make_rng();
|
||||
scenario.instantiate(&mut sim, &map, &mut rng, timer);
|
||||
sim.timed_step(&map, sim.get_end_of_day() - Time::START_OF_DAY, timer);
|
||||
if let Some(dt) = time_limit {
|
||||
sim.timed_step(&map, dt, timer);
|
||||
} else {
|
||||
sim.timed_step(&map, sim.get_end_of_day() - Time::START_OF_DAY, timer);
|
||||
}
|
||||
|
||||
abstutil::write_binary(
|
||||
abstutil::path_prebaked_results(&scenario.map_name, &scenario.scenario_name),
|
||||
|
@ -216,9 +216,10 @@ impl Manifest {
|
||||
|
||||
let mut remove = Vec::new();
|
||||
for path in self.0.keys() {
|
||||
// TODO One hardcoded weird exception
|
||||
if path == "data/system/scenarios/montlake/everyone_weekday.bin"
|
||||
&& !cities.runtime.contains(&"huge_seattle".to_string())
|
||||
// TODO Some hardcoded weird exceptions
|
||||
if !cities.runtime.contains(&"huge_seattle".to_string())
|
||||
&& (path == "data/system/scenarios/montlake/everyone_weekday.bin"
|
||||
|| path == "data/system/prebaked_results/lakeslice/weekday.bin")
|
||||
{
|
||||
remove.push(path.clone());
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user