File tree 3 files changed +8
-7
lines changed
3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ impl SearchNode {
89
89
}
90
90
91
91
fn utility ( & self ) -> usize {
92
- self . resources [ GEODE ] as usize
92
+ self . resources [ GEODE ]
93
93
}
94
94
95
95
fn expand ( & self , costs : & Blueprint ) -> Vec < SearchNode > {
@@ -206,7 +206,8 @@ fn compute_bound(
206
206
. min ( dt)
207
207
/ 2 ;
208
208
209
- spec_geode as usize
209
+ #[ allow( clippy:: let_and_return) ]
210
+ spec_geode
210
211
}
211
212
212
213
fn parse_res ( s : & str ) -> Res {
Original file line number Diff line number Diff line change @@ -383,7 +383,7 @@ fn search_sol(map: Map) -> (Map, usize) {
383
383
frontier. push ( SearchNode :: new ( & map_t[ 0 ] ) ) ;
384
384
385
385
// Search
386
- let mut sol : usize = usize:: MAX ;
386
+ let mut cost : usize = usize:: MAX ;
387
387
while let Some ( node) = frontier. pop ( ) {
388
388
if visited. contains ( & node) {
389
389
continue ;
@@ -393,7 +393,7 @@ fn search_sol(map: Map) -> (Map, usize) {
393
393
// goal
394
394
if node. pos == map_t[ 0 ] . end {
395
395
println ! ( "Solution: {}" , node) ;
396
- sol = node. t ;
396
+ cost = node. t ;
397
397
break ;
398
398
}
399
399
@@ -405,7 +405,7 @@ fn search_sol(map: Map) -> (Map, usize) {
405
405
}
406
406
visited. insert ( node) ;
407
407
}
408
- ( map_t. remove ( sol ) , sol )
408
+ ( map_t. remove ( cost ) , cost )
409
409
}
410
410
411
411
fn main ( ) {
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ impl Sub<Pos> for Pos {
19
19
type Output = Pos ;
20
20
fn sub ( self , rhs : Pos ) -> Self :: Output {
21
21
Pos (
22
- ( self . 0 - rhs. 0 ) . min ( 1 ) . max ( - 1 ) ,
23
- ( self . 1 - rhs. 1 ) . min ( 1 ) . max ( - 1 ) ,
22
+ ( self . 0 - rhs. 0 ) . clamp ( - 1 , 1 ) ,
23
+ ( self . 1 - rhs. 1 ) . clamp ( - 1 , 1 ) ,
24
24
)
25
25
}
26
26
}
You can’t perform that action at this time.
0 commit comments