コード例 #1
0
 static void Main(string[] args)
 {
     List<Player> players =  new List<Player>()
                             {
                                 new Player(0,"player1"),
                                 new Player(1,"player2")
                             };
     game = new Game(20000, players);
     foreach(Block block in game.map.blocks)
     {
         block.OnTokenPlaceInto += TokenInto;
         if (block is LandBlock)
         {
             block.OnTokenPlaceInto += PayForTollEventTask;
             block.OnTokenPlaceInto += UpgradeLandSelectionEventTask;
             block.OnTokenPlaceInto += BuyLandSelectionEventTask;
         }
         else if (block is StartBlock)
         {
             block.OnTokenPass += PassStartBlockEventTask;
         }
         else if (block is CardBlock)
         {
             block.OnTokenPlaceInto += DrawCardEventTask;
         }
     }
     Console.WriteLine("Game start....");
     string cmd;
     int steps;
     while(!game.gameOverFlag)
     {
         foreach(Player player in game.players)
         {
             Console.WriteLine(player.username+"'s turn. input roll to roll a dice");
             while ((cmd = Console.ReadLine()) != "roll")
             {
                 switch (cmd)
                 {
                     case "status":
                         {
                             PrintPlayerData(player);
                             break;
                         }
                     case "all":
                         {
                             PrintAllPlayer(players);
                             break;
                         }
                 }
             }
             steps = game.RollDice();
             Console.WriteLine("move {0} steps",steps);
             player.Move(steps);
         }
     }
 }