GameLoop() 공개 메소드

Main battleship game loop
public GameLoop ( string opponent, int width, int height, List ships, BattleshipPlayer player ) : void
opponent string Name of opponent
width int Width of board
height int Height of board
ships List Ships in play
player BattleshipPlayer
리턴 void
예제 #1
0
        /// <summary>
        /// Program entry method
        /// </summary>
        /// <param name="args">command line arguments - unused</param>
        static void Main(string[] args)
        {
            string opponent;
            if (args == null || args.Length < 1)
                // No opponent name supplied, create one
                opponent = Guid.NewGuid().ToString();
            else
                opponent = args[0];

            AdaptiveBattleshipPlayer player = new AdaptiveBattleshipPlayer();
            BattleshipGame game = new BattleshipGame();
            List<Ship> ships = new List<Ship>()
            {
                new Ship() { Code = "D", Size = 2 },
                new Ship() { Code = "S", Size = 3 },
                new Ship() { Code = "S", Size = 3 },
                new Ship() { Code = "C", Size = 4 },
                new Ship() { Code = "B", Size = 5 }
            };

            game.GameLoop(opponent, 10, 10, ships, player);
        }