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(); } }
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; }
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(); } }
public bool CheckMovements(Square Square, Player Player) { return Player.PossibleMovements(this, Square); }
public abstract bool PossibleMovements(Board board, Square Square);
public void SetSquare(Square Square) { this.Square = Square; }
public override bool PossibleMovements(Board board, Square Square) { return true; }