Skip to content

Commit

Permalink
Micro-optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
MortenLohne committed Jan 21, 2024
1 parent 50ce5e8 commit e09a0f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/evaluation/policy_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ fn has_immediate_win(policy_features: &PolicyFeatures) -> bool {
policy_features.move_onto_critical_square[1],
policy_features.spread_that_connects_groups_to_win[0],
]
.iter()
.any(|p| *p != 0.0)
.into_iter()
.any(|p| p != 0.0)
}

struct MovementSynopsis<const S: usize> {
Expand Down
2 changes: 1 addition & 1 deletion src/position/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ impl<const S: usize> Position<S> {

for square in square::squares_iterator::<S>() {
group_data.amount_in_group[group_data.groups[square] as usize].0 += 1;
if self[square].top_stone().map(Piece::is_road_piece) == Some(true) {
if self[square].top_stone().is_some_and(Piece::is_road_piece) {
group_data.amount_in_group[group_data.groups[square] as usize].1 =
group_data.amount_in_group[group_data.groups[square] as usize].1
| square.group_edge_connection();
Expand Down

0 comments on commit e09a0f3

Please sign in to comment.