Beispiel #1
0
    /// <summary>
    /// The AI takes its attacks until its go is over.
    /// </summary>
    /// <returns>The result of the last attack</returns>
    public override AttackResult Attack()
    {
        AttackResult result = default(AttackResult);
        int          row    = 0;
        int          column = 0;

        //keep hitting until a miss
        do
        {
            AIPlayer.Delay(this);

            GenerateCoords(ref row, ref column);
            //generate coordinates for shot
            result = _game.Shoot(row, column);
            //take shot
            ProcessShot(row, column, result);
        } while (result.Value != ResultOfAttack.Miss && result.Value != ResultOfAttack.GameOver && !SwinGame.WindowCloseRequested);

        return(result);
    }