Skip to content

Commit 149f704

Browse files
committed
Try to get boost
1 parent 6107a93 commit 149f704

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/solve.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pub fn solve_small(task: Task) -> Vec<Command> {
1515

1616
let width = map_points.iter().map(|p| p.x).max().unwrap() as usize + 1;
1717
let height = map_points.iter().map(|p| p.y).max().unwrap() as usize + 1;
18+
1819
let mut remaining = 0;
1920
let mut booster_map = Matrix::new(width, height, None);
2021
let mut passed = Matrix::new(width, height, true);
@@ -66,6 +67,8 @@ pub fn solve_small(task: Task) -> Vec<Command> {
6667
Point::new(0, 1),
6768
]);
6869
let mut hand_count = 0;
70+
let mut drill_count = 0;
71+
let mut drill_turns = 0;
6972

7073
while remaining > 0 {
7174
while hand_count > 0 && !new_bodies.is_empty() {
@@ -94,7 +97,11 @@ pub fn solve_small(task: Task) -> Vec<Command> {
9497
false
9598
}
9699
});
97-
if not_passed {
100+
let is_booster = match booster_map.get(c) {
101+
Some(Some(BoosterType::NewHand)) => !new_bodies.is_empty(),
102+
_ => false,
103+
};
104+
if not_passed || is_booster {
98105
for body in bodies {
99106
if let Some(false) = passed.try_set(body, true) {
100107
remaining -= 1;
@@ -106,14 +113,16 @@ pub fn solve_small(task: Task) -> Vec<Command> {
106113
while iter != cp {
107114
match booster_map.get(iter) {
108115
Some(Some(BoosterType::NewHand)) => {
109-
booster_map.set(iter, None);
110116
hand_count += 1;
111117
}
112-
Some(Some(BoosterType::FastMove)) => {
113-
booster_map.set(iter, None);
118+
Some(Some(BoosterType::FastMove)) => {}
119+
Some(Some(BoosterType::Drill)) => {
120+
drill_count += 1;
114121
}
115122
_ => {}
116123
}
124+
booster_map.set(iter, None);
125+
117126
let (mv, _cost) = match data.get(iter) {
118127
Some(Some((mv, cost))) => (mv, cost),
119128
_ => panic!("no data"),

0 commit comments

Comments
 (0)