示例#1
0
 public UpdatePieceAction(
     IBoardEntityFactory <TEntity> entityFactory,
     IBoardActionProvider <TEntity> actionProvider,
     IBoardState <TEntity> boardState
     ) : base(actionProvider, boardState)
 {
     _entityFactory = entityFactory;
 }
示例#2
0
 public ChessGame(
     IBoardEngineProvider <ChessPieceEntity> boardEngineProvider,
     IBoardEntityFactory <ChessPieceEntity> entityFactory,
     ICheckDetectionService checkDetectionService
     )
     : this(boardEngineProvider, checkDetectionService, new ChessBoardSetup(entityFactory))
 {
 }
示例#3
0
 public ChessBoardActionProvider(IBoardEntityFactory <ChessPieceEntity> entityFactory)
     : base(entityFactory)
 {
     Actions.Add((int)ChessMoveTypes.KingMove, (s) => new MoveOrTakeAction <ChessPieceEntity>(this, s));
     Actions.Add((int)ChessMoveTypes.CastleQueenSide, (s) => new CastleAction <ChessPieceEntity>(this, s));
     Actions.Add((int)ChessMoveTypes.CastleKingSide, (s) => new CastleAction <ChessPieceEntity>(this, s));
     Actions.Add((int)ChessMoveTypes.TakeEnPassant, (s) => new EnPassantAction(this, s));
     Actions.Add((int)ChessMoveTypes.PawnTwoStep, (s) => new PawnTwoStepAction(this, s));
 }
示例#4
0
 public static IBoardMoveService <ChessPieceEntity> BoardMoveService(
     ChessBoardActionProvider boardActionProvider         = null,
     IBoardEntityFactory <ChessPieceEntity> entityFactory = null
     )
 {
     return(new BoardMoveService <ChessPieceEntity>(
                boardActionProvider ?? ChessBoardActionProvider(entityFactory)
                ));
 }
 public BoardActionProvider(IBoardEntityFactory <TEntity> entityFactory)
 {
     Actions = new Dictionary <int, Func <IBoardState <TEntity>, IBoardAction> >
     {
         { (int)DefaultActions.MoveOnly, (s) => new MoveOnlyAction <TEntity>(this, s) },
         { (int)DefaultActions.TakeOnly, (s) => new TakeOnlyAction <TEntity>(this, s) },
         { (int)DefaultActions.MoveOrTake, (s) => new MoveOrTakeAction <TEntity>(this, s) },
         { (int)DefaultActions.UpdatePiece, (s) => new UpdatePieceAction <TEntity>(entityFactory, this, s) },
         { (int)DefaultActions.UpdatePieceWithTake, (s) => new UpdatePieceAction <TEntity>(entityFactory, this, s) },
     };
 }
示例#6
0
 public ChessGameService(
     ILogger <ChessGameService> logger,
     ILogger <ChessGame> chessGameLogger,
     ICheckDetectionService checkDetectionService,
     IBoardEngineProvider <ChessPieceEntity> boardEngineProvider,
     IBoardEntityFactory <ChessPieceEntity> entityFactory
     )
 {
     _checkDetectionService = checkDetectionService;
     _entityFactory         = entityFactory;
     _chessGameLogger       = chessGameLogger;
     _boardEngineProvider   = boardEngineProvider;
     _logger = logger;
 }
示例#7
0
 public static ChessBoardActionProvider ChessBoardActionProvider(IBoardEntityFactory <ChessPieceEntity> entityFactory = null)
 => new ChessBoardActionProvider(
     entityFactory ?? ChessPieceEntityFactory()
     );
示例#8
0
 public ChessBoardSetup(IBoardEntityFactory <ChessPieceEntity> entityFactory)
 {
     _entityFactory = entityFactory;
 }