Exemple #1
0
        public bool CanMove(FigureModel figure, SquareModel to)
        {
            switch (figure.Type)
            {
            case Figure.Pawn:
                return(CanMovePawn(figure, to.Position));

            case Figure.Rook:
                return(CanMoveRook(figure, to.Position));

            case Figure.Knight:
                return(CanMoveKnight(figure, to.Position));

            case Figure.Bishop:
                return(CanMoveBishop(figure, to.Position));

            case Figure.Queen:
                return(CanMoveQueen(figure, to.Position));

            case Figure.King:
                return(CanMoveKing(figure, to.Position));

            default:
                return(false);
            }
        }
 public BoardModel(Color startColor, bool fillBoard = false)
 {
     SquareList   = new SquareModel[HEIGHT, WIDTH];
     StepList     = new Stack <KeyValuePair <Vector, Vector> >();
     EatenList    = new Stack <FigureModel>(MAXFIGURECOUNT);
     playColor    = startColor;
     StepsPattern = new Pattern(startColor);
     if (fillBoard)
     {
         ResetDefault();
     }
     else
     {
         InitializeBoard();
     }
 }