pub trait CetkaikRepresentation {
type Perspective: Copy + Eq;
type AbsoluteCoord: Copy + Eq + Debug;
type RelativeCoord: Copy + Eq;
type AbsoluteBoard: Clone + Debug + IsAbsoluteBoard<PieceWithSide = Self::AbsolutePiece, Coord = Self::AbsoluteCoord>;
type RelativeBoard: Copy;
type AbsolutePiece: Copy + Eq;
type RelativePiece: Copy + Eq;
type AbsoluteField: Clone + Debug + IsField<PieceWithSide = Self::AbsolutePiece, Coord = Self::AbsoluteCoord, Side = Self::AbsoluteSide>;
type RelativeField;
type AbsoluteSide: Copy + Eq + Debug + Not;
type RelativeSide: Copy + Eq;
Show 27 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 relative_clone_and_set(
board: &Self::RelativeBoard,
coord: Self::RelativeCoord,
p: Option<Self::RelativePiece>
) -> Self::RelativeBoard;
fn absolute_get(
board: &Self::AbsoluteBoard,
coord: Self::AbsoluteCoord
) -> Option<Self::AbsolutePiece>;
fn is_tam_hue_by_default(coord: Self::RelativeCoord) -> bool;
fn relative_tam2() -> Self::RelativePiece;
fn absolute_tam2() -> Self::AbsolutePiece;
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_relative(
current_board: &Self::RelativeBoard
) -> Vec<Self::RelativeCoord>;
fn empty_squares_absolute(
current_board: &Self::AbsoluteBoard
) -> Vec<Self::AbsoluteCoord>;
fn hop1zuo1_of(
side: Self::AbsoluteSide,
field: &Self::AbsoluteField
) -> Vec<ColorAndProf>;
fn as_board_absolute(field: &Self::AbsoluteField) -> &Self::AbsoluteBoard;
fn as_board_mut_absolute(
field: &mut Self::AbsoluteField
) -> &mut Self::AbsoluteBoard;
fn as_board_relative(field: &Self::RelativeField) -> &Self::RelativeBoard;
fn is_water_relative(c: Self::RelativeCoord) -> bool;
fn is_water_absolute(c: Self::AbsoluteCoord) -> bool;
fn loop_over_one_side_and_tam(
board: &Self::RelativeBoard,
side: Self::RelativeSide,
f_tam_or_piece: &mut dyn FnMut(Self::RelativeCoord, Option<Profession>)
);
fn to_relative_field(
field: Self::AbsoluteField,
p: Self::Perspective
) -> Self::RelativeField;
fn to_relative_side(
side: Self::AbsoluteSide,
p: Self::Perspective
) -> Self::RelativeSide;
fn get_one_perspective() -> Self::Perspective;
fn absolute_distance(a: Self::AbsoluteCoord, b: Self::AbsoluteCoord) -> i32;
fn absolute_same_direction(
origin: Self::AbsoluteCoord,
a: Self::AbsoluteCoord,
b: Self::AbsoluteCoord
) -> bool;
fn to_cetkaikcore_absolute_side(a: Self::AbsoluteSide) -> Side;
fn from_cetkaikcore_absolute_side(a: Side) -> Self::AbsoluteSide;
fn has_prof_absolute(piece: Self::AbsolutePiece, prof: Profession) -> bool;
}
Required Associated Types§
type Perspective: Copy + Eq
type AbsoluteCoord: Copy + Eq + Debug
type RelativeCoord: Copy + Eq
type AbsoluteBoard: Clone + Debug + IsAbsoluteBoard<PieceWithSide = Self::AbsolutePiece, Coord = Self::AbsoluteCoord>
type RelativeBoard: Copy
type AbsolutePiece: Copy + Eq
type RelativePiece: Copy + Eq
type AbsoluteField: Clone + Debug + IsField<PieceWithSide = Self::AbsolutePiece, Coord = Self::AbsoluteCoord, Side = Self::AbsoluteSide>
type RelativeField
type AbsoluteSide: Copy + Eq + Debug + Not
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 relative_clone_and_set(
board: &Self::RelativeBoard,
coord: Self::RelativeCoord,
p: Option<Self::RelativePiece>
) -> Self::RelativeBoard
fn absolute_get(
board: &Self::AbsoluteBoard,
coord: Self::AbsoluteCoord
) -> Option<Self::AbsolutePiece>
fn is_tam_hue_by_default(coord: Self::RelativeCoord) -> bool
fn relative_tam2() -> Self::RelativePiece
fn absolute_tam2() -> Self::AbsolutePiece
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_relative(
current_board: &Self::RelativeBoard
) -> Vec<Self::RelativeCoord>
fn empty_squares_absolute(
current_board: &Self::AbsoluteBoard
) -> Vec<Self::AbsoluteCoord>
fn hop1zuo1_of(
side: Self::AbsoluteSide,
field: &Self::AbsoluteField
) -> Vec<ColorAndProf>
fn as_board_absolute(field: &Self::AbsoluteField) -> &Self::AbsoluteBoard
fn as_board_mut_absolute(
field: &mut Self::AbsoluteField
) -> &mut Self::AbsoluteBoard
fn as_board_relative(field: &Self::RelativeField) -> &Self::RelativeBoard
fn is_water_relative(c: Self::RelativeCoord) -> bool
fn is_water_absolute(c: Self::AbsoluteCoord) -> bool
fn loop_over_one_side_and_tam(
board: &Self::RelativeBoard,
side: Self::RelativeSide,
f_tam_or_piece: &mut dyn FnMut(Self::RelativeCoord, Option<Profession>)
)
fn to_relative_field(
field: Self::AbsoluteField,
p: Self::Perspective
) -> Self::RelativeField
fn to_relative_side(
side: Self::AbsoluteSide,
p: Self::Perspective
) -> Self::RelativeSide
fn get_one_perspective() -> Self::Perspective
fn absolute_distance(a: Self::AbsoluteCoord, b: Self::AbsoluteCoord) -> i32
fn absolute_same_direction(
origin: Self::AbsoluteCoord,
a: Self::AbsoluteCoord,
b: Self::AbsoluteCoord
) -> bool
fn to_cetkaikcore_absolute_side(a: Self::AbsoluteSide) -> Side
fn from_cetkaikcore_absolute_side(a: Side) -> Self::AbsoluteSide
fn has_prof_absolute(piece: Self::AbsolutePiece, prof: Profession) -> bool
Implementors§
source§impl CetkaikRepresentation for CetkaikCompact
impl CetkaikRepresentation for CetkaikCompact
cetkaik_compact_representation
クレートに基づいており、視点を決め打ちして絶対座標=相対座標として表現する。
この impl においては、IAは常に一番下の行であり、初期状態でIA行を占有していたプレイヤーは駒が上向き(=あなた)である。
つまり、Upward
は常に IASide
へと読み替えられる。
type Perspective = Perspective
type AbsoluteCoord = Coord
type RelativeCoord = Coord
type AbsoluteBoard = Board
type RelativeBoard = Board
type AbsolutePiece = PieceWithSide
type RelativePiece = PieceWithSide
type AbsoluteField = Field
type RelativeField = Field
type AbsoluteSide = Side
type RelativeSide = Side
source§impl CetkaikRepresentation for CetkaikCore
impl CetkaikRepresentation for CetkaikCore
cetkaik_core
クレートに基づいており、視点に依らない絶対座標での表現と、視点に依る相対座標への表現を正しく相互変換できる。