Пример #1
0
 public void InitalizeSquares()
 {
     for (int i = 0; i < LENGTH_GRID; i++)
     {
         for (int j = 0; j < LENGTH_GRID; j++)
         {
             Square square = new Square(j, i, this);
             this.Squares.Add(square);
         }
         Square.OffsetColor();
     }
 }
Пример #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 void MoveSelectedPonTo(Square NewSquare)
        {
            var Pon = RemoveSelectedPonFromTheBoard();
            if (Pon != null)
            {
                BoardXML.Children.Remove(Pon.Get());
                NewSquare.SetPon(Pon);
                Pon.SetSquare(NewSquare);

                Grid.SetColumn(NewSquare.GetPon().Get(), NewSquare.GetColumn());
                Grid.SetRow(NewSquare.GetPon().Get(), NewSquare.GetRow());
                BoardXML.Children.Add(Pon.Get());

                ResetSelectedSquares();
                Pon.Deselect();
            }
        }
Пример #4
0
 public bool CheckMovements(Square Square, Player Player)
 {
     return Player.PossibleMovements(this, Square);
 }
Пример #5
0
 public abstract bool PossibleMovements(Board board, Square Square);
Пример #6
0
 public void SetSquare(Square Square)
 {
     this.Square = Square;
 }
Пример #7
0
 public override bool PossibleMovements(Board board, Square Square)
 {
     return true;
 }