Skip to content

Commit

Permalink
refactor(06/2024): improve variable naming
Browse files Browse the repository at this point in the history
  • Loading branch information
manhunto committed Dec 7, 2024
1 parent ff97520 commit 919c2ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/solutions/year2024/day06.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ impl Solution for Day06 {
let grid: Grid<char> = Grid::from(input);

let obstructions = grid.get_all_positions(&OBSTRUCTION);
let guard = grid.get_first_position(&STARTING_POSITION).unwrap();
let starting_point = grid.get_first_position(&STARTING_POSITION).unwrap();
let surface = grid.surface_range();

let mut guard = Vector::new(guard, North);
let mut guard = Vector::new(starting_point, North);
let mut visited_positions: HashSet<Point> = HashSet::new();

while surface.contains(guard.position()) {
Expand All @@ -35,10 +35,10 @@ impl Solution for Day06 {
let grid: Grid<char> = Grid::from(input);

let obstructions = grid.get_all_positions(&OBSTRUCTION);
let guard = grid.get_first_position(&STARTING_POSITION).unwrap();
let starting_point = grid.get_first_position(&STARTING_POSITION).unwrap();
let surface = grid.surface_range();

let mut guard = Vector::new(guard, North);
let mut guard = Vector::new(starting_point, North);
guard = self.next_step(guard, &obstructions); // skip initial position

let mut loop_count: u32 = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ mod tests {
use crate::utils::range::Range;

#[test]
fn is_in_range() {
fn contains() {
let range = Range::new(5, 7).unwrap();

assert!(!range.contains(4));
Expand Down

0 comments on commit 919c2ca

Please sign in to comment.