pub trait IsBoard {
    type PieceWithSide: Copy;
    type Coord: Copy + Debug;
    type EmptySquaresIter: Iterator<Item = Self::Coord>;

    fn peek(&self, c: Self::Coord) -> Option<Self::PieceWithSide>;
    fn pop(&mut self, c: Self::Coord) -> Option<Self::PieceWithSide>;
    fn put(&mut self, c: Self::Coord, p: Option<Self::PieceWithSide>);
    fn assert_empty(&self, c: Self::Coord);
    fn assert_occupied(&self, c: Self::Coord);
    fn empty_squares(&self) -> Self::EmptySquaresIter;

    fn mov(&mut self, from: Self::Coord, to: Self::Coord) { ... }
}
Expand description

A trait that signifies that you can use it as a BoardBoard として扱える型を表すトレイト

Required Associated Types§

A type that represents the piece

A type that represents the coordinate

Required Methods§

peek

pop

put either a piece or a None

assert that the square is empty

assert that the square is occupied

Provided Methods§

Moves the piece located at from to an empty square to.

Panics

Should panics if either:

  • from is unoccupied
  • to is already occupied

Implementors§