Exemple #1
0
 public override void Generate_steps(Board board)
 {
     PossibleSteps.Clear();
     Generate(true, PossibleSteps, board, current);
     Generate(false, PossibleSteps, board, current);
     Show();
 }
Exemple #2
0
 public override void Generate_steps(Board board)
 {
     PossibleSteps.Clear();
     Rook.Generate(true, PossibleSteps, board, current);
     Rook.Generate(false, PossibleSteps, board, current);
     Bishop.Generate(true, PossibleSteps, board, current);
     Bishop.Generate(false, PossibleSteps, board, current);
 }
Exemple #3
0
 public void Generate_for_end(Board board)
 {
     PossibleSteps.Clear();
     for (int i = -1; i < 2; i++)
     {
         for (int j = -1; j < 2; j++)
         {
             if (Board.IsCorrectCoordinates(current.X + i, current.Y + j))
             {
                 if (board[current.X + i, current.Y + j].figure == null)
                 {
                     PossibleSteps.Add(board[current.X + i, current.Y + j]);
                     board[current.X + i, current.Y + j].condition = Condition.EmptyWaiting;
                 }
             }
         }
     }
 }
Exemple #4
0
        public override void Generate_steps(Board board)
        {
            PossibleSteps.Clear();
            int kv = -1, kh = -1;

            for (int i = 1; i <= 2; i++)
            {
                for (int j = 1; j <= 2; j++)
                {
                    bool ok = Board.IsCorrectCoordinates(current.X + 2 * kv * (int)color, current.Y + kh * (int)color);
                    if (ok)
                    {
                        if (board[current.X + 2 * kv * (int)color, current.Y + kh * (int)color].figure == null)
                        {
                            PossibleSteps.Add(board[current.X + 2 * kv * (int)color, current.Y + kh * (int)color]);
                            board[current.X + 2 * kv * (int)color, current.Y + kh * (int)color].condition = Condition.EmptyWaiting;
                        }
                        else
                        if (board[current.X + 2 * kv * (int)color, current.Y + kh * (int)color].figure.color != Chesses.CurrentColor)
                        {
                            PossibleSteps.Add(board[current.X + 2 * kv * (int)color, current.Y + kh * (int)color]);
                            board[current.X + 2 * kv * (int)color, current.Y + kh * (int)color].condition = Condition.FilledWaiting;
                        }
                    }
                    ok = Board.IsCorrectCoordinates(current.X + kv * (int)color, current.Y + kh * 2 * (int)color);
                    if (ok)
                    {
                        if (board[current.X + kv * (int)color, current.Y + kh * 2 * (int)color].figure == null)
                        {
                            PossibleSteps.Add(board[current.X + kv * (int)color, current.Y + kh * 2 * (int)color]);
                            board[current.X + kv * (int)color, current.Y + kh * 2 * (int)color].condition = Condition.EmptyWaiting;
                        }
                        else
                        if (board[current.X + kv * (int)color, current.Y + kh * 2 * (int)color].figure.color != Chesses.CurrentColor)
                        {
                            PossibleSteps.Add(board[current.X + kv * (int)color, current.Y + kh * 2 * (int)color]);
                            board[current.X + kv * (int)color, current.Y + kh * 2 * (int)color].condition = Condition.FilledWaiting;
                        }
                    }
                    kh *= -1;
                }
                kv *= -1;
            }
        }
Exemple #5
0
        public override void Generate_steps(Board board)
        {
            PossibleSteps.Clear();

            if (Board.IsCorrectCoordinates(current.X + (int)color, current.Y))
            {
                if (board[current.X + (int)color, current.Y].figure == null)
                {
                    PossibleSteps.Add(board[current.X + (int)color, current.Y]);
                    board[current.X + (int)color, current.Y].condition = Condition.EmptyWaiting;
                    if (isFirstStep)
                    {
                        if (board[current.X + 2 * (int)color, current.Y].figure == null)
                        {
                            PossibleSteps.Add(board[current.X + 2 * (int)color, current.Y]);
                            board[current.X + 2 * (int)color, current.Y].condition = Condition.EmptyWaiting;
                        }
                    }
                }
            }
            if (Board.IsCorrectCoordinates(current.X + (int)color, current.Y - 1))
            {
                if (board[current.X + (int)color, current.Y - 1].figure != null &&
                    board[current.X + (int)color, current.Y - 1].figure.color != color)
                {
                    PossibleSteps.Add(board[current.X + (int)color, current.Y - 1]);
                    board[current.X + (int)color, current.Y - 1].condition = Condition.FilledWaiting;
                }
            }
            if (Board.IsCorrectCoordinates(current.X + (int)color, current.Y + 1))
            {
                if (board[current.X + (int)color, current.Y + 1].figure != null &&
                    board[current.X + (int)color, current.Y + 1].figure.color != color)
                {
                    PossibleSteps.Add(board[current.X + (int)color, current.Y + 1]);
                    board[current.X + (int)color, current.Y + 1].condition = Condition.FilledWaiting;
                }
            }
        }
Exemple #6
0
 public override void Generate_steps(Board board)
 {
     PossibleSteps.Clear();
     for (int i = -1; i < 2; i++)
     {
         for (int j = -1; j < 2; j++)
         {
             if (Board.IsCorrectCoordinates(current.X + i, current.Y + j))
             {
                 if (board[current.X + i, current.Y + j].figure == null)
                 {
                     PossibleSteps.Add(board[current.X + i, current.Y + j]);
                     board[current.X + i, current.Y + j].condition = Condition.EmptyWaiting;
                 }
                 else
                 if (board[current.X + i, current.Y + j].figure.color != color)
                 {
                     PossibleSteps.Add(board[current.X + i, current.Y + j]);
                     board[current.X + i, current.Y + j].condition = Condition.FilledWaiting;
                 }
             }
         }
     }
 }