예제 #1
0
 public override bool IsBlockedIfMove(Doska.Yacheika from, Doska.Yacheika to, Doska.Yacheika blocked)
 {
     foreach (Napravlenie direction in directions)
     {
         if (!direction.IsBlockedIfMove(from, to, blocked))
         {
             return(false);
         }
     }
     return(true);
 }
예제 #2
0
 public override bool IsBlockedIfMove(Doska.Yacheika from, Doska.Yacheika to, Doska.Yacheika blocked)
 {
     for (int i = 0; i < 8; i++)
     {
         if (possibleCells[i] == blocked)
         {
             return(false);
         }
     }
     return(true);
 }
예제 #3
0
 public override void Recalculate()
 {
     if (!Moved)
     {
         canCastleLeft = true;
         Doska.Yacheika leftRookCell = Parent.Parent.GetCell(0, (Color == PlayerColor.White) ? 0 : 7);
         if (leftRookCell.Piece == null || !(leftRookCell.Piece is Ladiya) || leftRookCell.Piece.Color != Color || leftRookCell.Piece.Moved)
         {
             canCastleLeft = false;
         }
         else
         {
             for (int i = 1; i <= 3; i++)
             {
                 if (Parent.Parent.GetCell(i, (Color == PlayerColor.White) ? 0 : 7).Piece != null)
                 {
                     canCastleLeft = false;
                 }
             }
         }
         canCastleRight = true;
         Doska.Yacheika rightRookCell = Parent.Parent.GetCell(7, (Color == PlayerColor.White) ? 0 : 7);
         if (rightRookCell.Piece == null || !(rightRookCell.Piece is Ladiya) || rightRookCell.Piece.Color != Color || rightRookCell.Piece.Moved)
         {
             canCastleRight = false;
         }
         else
         {
             for (int i = 5; i <= 6; i++)
             {
                 if (Parent.Parent.GetCell(i, (Color == PlayerColor.White) ? 0 : 7).Piece != null)
                 {
                     canCastleRight = false;
                 }
             }
         }
     }
     directions[0] = new Napravlenie(this, 0, 1, 1);
     directions[1] = new Napravlenie(this, 0, -1, 1);
     directions[2] = new Napravlenie(this, -1, 0, 1);
     directions[3] = new Napravlenie(this, 1, 0, 1);
     directions[4] = new Napravlenie(this, -1, 1, 1);
     directions[5] = new Napravlenie(this, 1, 1, 1);
     directions[6] = new Napravlenie(this, -1, -1, 1);
     directions[7] = new Napravlenie(this, 1, -1, 1);
 }
예제 #4
0
파일: Peshka.cs 프로젝트: 70rustsk/repos
 protected override bool canHit(Doska.Yacheika yacheika)
 {
     return(base.canHit(yacheika) || (yacheika != null && yacheika == yacheika.Parent.EnPassant));
 }
예제 #5
0
파일: Peshka.cs 프로젝트: 70rustsk/repos
 public override bool IsBlockedIfMove(Doska.Yacheika from, Doska.Yacheika to, Doska.Yacheika blocked)
 {
     return(hits[0] != blocked && hits[1] != blocked);
 }