UNPKG

@obliczeniowo/elementary

Version:
37 lines (36 loc) 1.97 kB
import { Address } from './address'; import { QueryList } from '@angular/core'; import { ChessPawnComponent } from '../components/chess-pawn/chess-pawn.component'; import { ChessEnum } from './../enums/enums'; export type ChessPiece = ChessEnum.whiteKing | ChessEnum.whiteQueen | ChessEnum.whiteRook | ChessEnum.whiteBishop | ChessEnum.whiteKnight | ChessEnum.whitePawn | ChessEnum.blackKing | ChessEnum.blackQueen | ChessEnum.blackRook | ChessEnum.blackBishop | ChessEnum.blackKnight | ChessEnum.blackPawn; export declare abstract class AbstractPiece { protected _type: ChessPiece; get type(): ChessPiece; protected _address: Address | undefined; get address(): Address | undefined; constructor(type: ChessPiece, address: Address | undefined); abstract moveFieldsList(chessPieces: QueryList<ChessPawnComponent>): string[]; protected isEmpty(address: Address | undefined, chessPieces: QueryList<ChessPawnComponent>): boolean; protected isOppositePiece(address: Address | undefined, chessPieces: QueryList<ChessPawnComponent>): boolean; } export declare class Pawn extends AbstractPiece { moveFieldsList(chessPieces: QueryList<ChessPawnComponent>): string[]; } export declare class Knight extends AbstractPiece { moveFieldsList(chessPieces: QueryList<ChessPawnComponent>): string[]; } export declare class Bishop extends AbstractPiece { moveFieldsList(chessPieces: QueryList<ChessPawnComponent>): string[]; } export declare class Rook extends AbstractPiece { moveFieldsList(chessPieces: QueryList<ChessPawnComponent>): string[]; } export declare class Queen extends AbstractPiece { moveFieldsList(chessPieces: QueryList<ChessPawnComponent>): string[]; } export declare class King extends AbstractPiece { moveFieldsList(chessPieces: QueryList<ChessPawnComponent>): string[]; } export declare class AbstractPieceFactory { static getPiece(type: ChessPiece, address: Address | undefined): AbstractPiece | undefined; }