pub trait Grid<T>where
    Self: Sized,{
    const NEG1: T;
    const ADJ4: [(T, T); 4];
    const ADJ8: [(T, T); 8];

    // Required methods
    fn get_adj_4(&self, H: usize, W: usize) -> Vec<Self>;
    fn get_adj_8(&self, H: usize, W: usize) -> Vec<Self>;
}
Expand description

グリッドの探索

Required Associated Constants§

source

const NEG1: T

usizeにおける-1

source

const ADJ4: [(T, T); 4]

隣接する4方向(上下左右)

source

const ADJ8: [(T, T); 8]

隣接する8方向

Required Methods§

source

fn get_adj_4(&self, H: usize, W: usize) -> Vec<Self>

座標(i,j)に上下左右で隣接する座標を取得 (グリッドサイズHxWでバリデーション)

探索順

   2
   ↑
3 ← → 1
   ↓
   4
source

fn get_adj_8(&self, H: usize, W: usize) -> Vec<Self>

座標(i,j)に8方向で隣接する座標を取得 (グリッドサイズHxWでバリデーション)

探索順

4  3  2
  ↖↑↗
5 ← → 1
  ↙↓➘
6  7  8

Implementations on Foreign Types§

source§

impl Grid<usize> for (usize, usize)

source§

const NEG1: usize = 18_446_744_073_709_551_615usize

source§

const ADJ4: [(usize, usize); 4] = _

source§

const ADJ8: [(usize, usize); 8] = _

source§

fn get_adj_4(&self, H: usize, W: usize) -> Vec<(usize, usize)>

source§

fn get_adj_8(&self, H: usize, W: usize) -> Vec<(usize, usize)>

Implementors§