advent_of_code_2024::day_16

Trait CoordinateExtensions

source
trait CoordinateExtensions {
    // Required methods
    fn manhattan_distance(&self, other: &Self) -> u32;
    fn turn_cost(&self, other: &Self, facing: &Facing) -> u32;
}
Expand description

Helper trait to add methods to the built-in (u8, u8) Coordinate type

Required Methods§

source

fn manhattan_distance(&self, other: &Self) -> u32

source

fn turn_cost(&self, other: &Self, facing: &Facing) -> u32

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl CoordinateExtensions for (u8, u8)

source§

fn manhattan_distance(&self, other: &Self) -> u32

Manhattan distance between two points

source§

fn turn_cost(&self, other: &Self, facing: &Facing) -> u32

What is the cost for the minimum number of turns required to meet the goal if no hedges block the shortest path, given the position, goal and current facing.

Implementors§