Output results as required

This commit is contained in:
Arne Keller 2019-02-02 16:28:27 +01:00
parent 270216531a
commit 4ac40016fb

View File

@ -42,6 +42,7 @@ fn main() {
// 07:00: Bus ist 15 km entfernt
let start_time = NaiveTime::from_hms(7, 0, 0);
let bus = Point::new(0.0, -15000.0);
let bus_start = bus;
// 30 km/h -> 8.3 m/s
let bus_speed = 30.0 / 3.6;
// Zeitpunkt basierend auf Wartezeit in Sekunden berechnen
@ -154,12 +155,28 @@ fn main() {
states.extend(all);
}
}
eprintln!("Zeit = {:?}", delay_to_time(best_delay));
let route = best;
eprintln!("Startzeit: {:?}", delay_to_time(best_delay));
eprintln!("Zielzeit: {:?}", delay_to_time(route.last().unwrap().bus.y() - bus_start.y()));
eprintln!("Treffpunkt: y={:.0}", route.last().unwrap().pos.y());
let mut length = 0.0;
let mut last = &house;
eprintln!("Route:");
for s in &route {
eprintln!("{:.02},{:.02}", s.pos.x(), s.pos.y());
if s.pos == house {
eprint!("Lisas Haus: ")
} else if s.pos.x() == 0.0 {
eprint!("Treffpunkt: ")
} else {
eprint!("Polygon {:02}: ", polys.iter().position(|p| p.exterior.0.contains(&s.pos.into())).unwrap() + 1);
}
eprintln!("x={:.02} y={:.02}", s.pos.x(), s.pos.y());
length += last.euclidean_distance(&s.pos);
last = &s.pos;
}
eprintln!("Länge: {:.0}m", length);
let seconds = length / (15.0 / 3.6);
eprintln!("Dauer: {:02.0}:{:02.0}", seconds / 60.0, seconds % 60.0);
display::dump_route(house, &polys, &route);
}