Exemplo n.º 1
0
        public List <string> CheckIfCanMovePiece(string ChessmanPosition, ChessPiceType Chessman)
        {
            IBoardService     boardService = new BoardService();
            PiceFactory       piceFactory  = new PiceFactory();
            IChessMoveChecker pice         = piceFactory.CreatePice(Chessman);

            return(pice.AvailableMoves(ChessmanPosition, boardService));
        }
Exemplo n.º 2
0
        public ChessMoveResponse PostCheckMove(ChessMoveRequest item)
        {
            IBoardService     boardService = new BoardService();
            PiceFactory       piceFactory  = new PiceFactory();
            IChessMoveChecker pice         = piceFactory.CreatePice(item.ChessPice);
            ChessMoveResponse resp         = new ChessMoveResponse();

            resp.IsAvailable = pice.CheckMove(item.StartPosition, item.DestinationPosition, boardService);
            if (resp.IsAvailable)
            {
                resp.Message = "Message from Backend. Move is available.";
            }
            else
            {
                resp.Message = "Message from Backend. Move is NOT available.";
            }

            return(resp);
        }