示例#1
0
        public void CheckIfAIPlayerIsSetupCorrectly()
        {
            AIPlayer        player;
            BattleShipsGame game = new BattleShipsGame();

            player = new AIEasyPlayer(game);
            if (player.Hits != 0)
            {
                Assert.AreNotEqual(player.Hits, 0);
            }
            if (player.Missed != 0)
            {
                Assert.AreNotEqual(player.Missed, 0);
            }
            if (player.Score != 0)
            {
                Assert.AreNotEqual(player.Score, 0);
            }
            if (player.Shots != 0)
            {
                Assert.AreNotEqual(player.Shots, 0);
            }
            if (player.ReadyToDeploy != false)
            {
                Assert.AreNotEqual(player.ReadyToDeploy, false);
            }
        }
示例#2
0
    /// <summary>
    /// Creates a new AI player based on the current setting
    /// Returns the created ai
    /// </summary>
    public static AIPlayer CreateAIPlayer(AIOption setting)
    {
        AIPlayer player = null;

        switch (setting)
        {
        case AIOption.Easy:
            player = new AIEasyPlayer(_theGame);
            break;

        case AIOption.Medium:
            player = new AIMediumPlayer(_theGame);
            break;

        case AIOption.Hard:
            player = new AIHardPlayer(_theGame);
            break;

        default:
            player = new AIHardPlayer(_theGame);
            break;
        }
        return(player);
    }