Add utils for hexagonal grild #50

Merged
tipragot merged 23 commits from hex-utils into main 2024-02-14 17:49:08 +00:00
Showing only changes of commit 9a4fb1a5fd - Show all commits

View file

@ -68,6 +68,8 @@ impl HexPosition {
///
/// ## example
/// ```
/// use border_wars::hex::HexPosition;
///
/// let hex1 = HexPosition { q: 0, r: 0 };
/// let hex2 = HexPosition { q: 1, r: 1 };
/// let distance = hex1.distance_to(&hex2);
@ -84,6 +86,8 @@ impl HexPosition {
///
/// ## example
/// ```
/// use border_wars::hex::HexPosition;
///
/// let hex = HexPosition { q: 0, r: 0 };
/// let positions = hex.range(1);
/// assert_eq!(positions.len(), 6);