pub trait CetkaikRepresentation {
type AbsoluteCoord;
type RelativeCoord: Copy;
type Perspective;
type RelativeBoard: Copy;
type RelativePiece: Copy + Eq;
type RelativeSide: Copy + Eq;
fn to_absolute_coord(
coord: Self::RelativeCoord,
p: Self::Perspective
) -> Self::AbsoluteCoord;
fn add_delta(
coord: Self::RelativeCoord,
row_delta: isize,
col_delta: isize
) -> Option<Self::RelativeCoord>;
fn relative_get(
board: Self::RelativeBoard,
coord: Self::RelativeCoord
) -> Option<Self::RelativePiece>;
fn is_tam_hue_by_default(coord: Self::RelativeCoord) -> bool;
fn tam2() -> Self::RelativePiece;
fn is_upward(s: Self::RelativeSide) -> bool;
fn match_on_piece_and_apply<U>(
piece: Self::RelativePiece,
f_tam: &dyn Fn() -> U,
f_piece: &dyn Fn(Profession, Self::RelativeSide) -> U
) -> U;
fn empty_squares(
current_board: &Self::RelativeBoard
) -> Vec<Self::RelativeCoord>;
}
Required Associated Types§
type AbsoluteCoord
type RelativeCoord: Copy
type Perspective
type RelativeBoard: Copy
type RelativePiece: Copy + Eq
type RelativeSide: Copy + Eq
Required Methods§
fn to_absolute_coord(
coord: Self::RelativeCoord,
p: Self::Perspective
) -> Self::AbsoluteCoord
fn add_delta(
coord: Self::RelativeCoord,
row_delta: isize,
col_delta: isize
) -> Option<Self::RelativeCoord>
fn relative_get(
board: Self::RelativeBoard,
coord: Self::RelativeCoord
) -> Option<Self::RelativePiece>
fn is_tam_hue_by_default(coord: Self::RelativeCoord) -> bool
fn tam2() -> Self::RelativePiece
fn is_upward(s: Self::RelativeSide) -> bool
fn match_on_piece_and_apply<U>(
piece: Self::RelativePiece,
f_tam: &dyn Fn() -> U,
f_piece: &dyn Fn(Profession, Self::RelativeSide) -> U
) -> U
fn empty_squares(
current_board: &Self::RelativeBoard
) -> Vec<Self::RelativeCoord>
Implementors§
source§impl CetkaikRepresentation for CetkaikCompact
impl CetkaikRepresentation for CetkaikCompact
cetkaik_compact_representation
クレートに基づいており、視点を決め打ちして絶対座標=相対座標として表現する。
この impl においては、IAは常に一番下の行であり、初期状態でIA行を占有していたプレイヤーは駒が上向き(=あなた)である。
つまり、Upward
は常に IASide
へと読み替えられる。
type AbsoluteCoord = Coord
type RelativeCoord = Coord
type Perspective = Perspective
type RelativeBoard = Board
type RelativePiece = PieceWithSide
type RelativeSide = Side
source§impl CetkaikRepresentation for CetkaikCore
impl CetkaikRepresentation for CetkaikCore
cetkaik_core
クレートに基づいており、視点に依らない絶対座標での表現と、視点に依る相対座標への表現を正しく相互変換できる。