Skip to content

Commit

Permalink
Fmt so we can deploy in CircleCI, which I believe goes to Digital Ocean
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyja committed Jan 20, 2024
1 parent 2dc5e37 commit 3906a75
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
3 changes: 2 additions & 1 deletion sherlock/src/unofficial_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ pub(crate) fn get_frames_for_game(game_id: &str, end_turn: usize) -> Result<Vec<

let mut all_frames: Vec<Value> = Vec::with_capacity(end_turn);

while let Some(frames) = get_batch_of_frames_for_games(game_id, offset, LIMIT)? && !frames.is_empty()
while let Some(frames) = get_batch_of_frames_for_games(game_id, offset, LIMIT)?
&& !frames.is_empty()
{
all_frames.extend(frames.iter().cloned());
offset += LIMIT;
Expand Down
28 changes: 16 additions & 12 deletions web-axum/src/hobbs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ pub(crate) async fn route_hobbs_move(

let you_id = game.you_id();

let initial_return = if let Some(last_move) = last_move && last_move.turn == turn - 1 {
let initial_return = if let Some(last_move) = last_move
&& last_move.turn == turn - 1
{
let last_board = &last_move.last_board;
let previously_alive_snakes = game_state
.id_map
Expand Down Expand Up @@ -142,24 +144,26 @@ pub(crate) async fn route_hobbs_move(

let mut current_return = last_move.last_return.clone();

while
let Some(moving_snake_id) = current_return.moving_snake_id() &&
let Some(m) = snake_moves.remove(moving_snake_id) &&
let Some(next_return) = current_return.option_for_move(m)
{
while let Some(moving_snake_id) = current_return.moving_snake_id()
&& let Some(m) = snake_moves.remove(moving_snake_id)
&& let Some(next_return) = current_return.option_for_move(m)
{
current_return = next_return.clone();
}

while
let MinMaxReturn::Node { ref options, moving_snake_id, .. } = current_return &&
moving_snake_id == *you_id {
let new_return = options[0].1.clone();
current_return = new_return;
while let MinMaxReturn::Node {
ref options,
moving_snake_id,
..
} = current_return
&& moving_snake_id == *you_id
{
let new_return = options[0].1.clone();
current_return = new_return;
}

Some(current_return)
} else {

None
};

Expand Down

0 comments on commit 3906a75

Please sign in to comment.