Пример #1
0
        public Square(int column, int row, Board Board)
        {
            this.Rec = new Rectangle();
            this.Rec.Height = this.Rec.Width = 75;
            this.Rec.HorizontalAlignment = HorizontalAlignment.Center;
            this.Rec.VerticalAlignment = VerticalAlignment.Center;
            this.Rec.Stroke = Brushes.Black;
            DefineColor();

            this.Rec.MouseLeftButtonDown += OnMouseLeftClick;

            this.Column = column;
            this.Row = row;
            this.Board = Board;
            this.Hovered = false;
            this.PossibleManger = false;
        }
Пример #2
0
        public override bool PossibleMovements(Board board, Square Square)
        {
            bool possible = false;
            bool reset = false;
            bool left = false;
            for (int i = Square.GetColumn() - 1; i <= Square.GetColumn() + 1; i++)
            {
                var SquareTMP = board.SquareAt(i, Square.GetRow() - 1);

                if (SquareTMP != null && !SquareTMP.GetColored()) continue;
                left = !left;

                if (!reset)
                {
                    board.ResetSelectedSquares();
                    reset = true;
                }

                if (SquareTMP.GetPon() == null)
                {
                    SquareTMP.IsHovered();
                    possible = true;
                }
                else if (SquareTMP.GetPon() != null && SquareTMP.GetPon().GetPlayer().GetIa())
                {
                    Square SquareTMPPlus1 = null;
                    if (left)
                    {
                        SquareTMPPlus1 = board.SquareAt(i - 1, Square.GetRow() - 2);
                    }
                    else
                    {
                        SquareTMPPlus1 = board.SquareAt(i + 1, Square.GetRow() + 2);
                    }

                    if (SquareTMPPlus1 != null && SquareTMPPlus1.GetPon() == null)
                    {
                        SquareTMP.IsPossibleManger();
                        possible = true;
                    }
                }

            }
            return possible;
        }
Пример #3
0
 public abstract bool PossibleMovements(Board board, Square Square);
Пример #4
0
 public override bool PossibleMovements(Board board, Square Square)
 {
     return true;
 }