Exemplo n.º 1
0
        public void PlaceStart(IGameState state, IStartActions actions)
        {
            Console.WriteLine("It is your turn to place a starting settlement (#" + assignedId + ")");
            var settlement = getSettlementPosition();

            actions.BuildSettlement(settlement);
            Console.WriteLine("Place a road connected to the settlement you just placed");
            var road = getRoadPosition();

            actions.BuildRoad(road);
        }
Exemplo n.º 2
0
        public void PlaceStart(IGameState state, IStartActions actions)
        {
            if (!silent)
            {
                Console.WriteLine(id + ": Place starts");
            }

            var spos = FindBestIntersection(state.Board.GetAllIntersections()
                                            .Where(i => state.Board.GetPiece(i) == null &&
                                                   state.Board.HasNoNeighbors(i)), state.Board);

            actions.BuildSettlement(spos);
            actions.BuildRoad(FindBestRoad(spos, state.Board));
        }
Exemplo n.º 3
0
 public void PlaceStart(IGameState state, IStartActions actions)
 {
     Console.WriteLine("It is your turn to place a starting settlement (#" + assignedId + ")");
     var settlement = getSettlementPosition();
     actions.BuildSettlement(settlement);
     Console.WriteLine("Place a road connected to the settlement you just placed");
     var road = getRoadPosition();
     actions.BuildRoad(road);
 }
Exemplo n.º 4
0
 public void PlaceStart(IGameState state, IStartActions actions)
 {
     if (!silent)
     {
         Console.WriteLine(id + ": Place starts");
     }
     if (!firstStartPlaced)
     {
         firstStartPlaced = true;
         actions.BuildSettlement(start1);
         if (!silent)
         {
             Console.WriteLine(id + ": First settlement built succesfully");
         }
         actions.BuildRoad(new Edge(start1.FirstTile, start1.SecondTile));
         if (!silent)
         {
             Console.WriteLine(id + ": First road built succesfully");
         }
     }
     else
     {
         try
         {
             actions.BuildSettlement(start1);
             if (!silent)
             {
                 Console.WriteLine(id + ": Controller allowed a building on top of another");
             }
         }
         catch (IllegalBuildPositionException e)
         {
             if (!silent)
             {
                 Console.WriteLine(id + ": Controller threw exception as expected: " + e.Message);
             }
         }
         try
         {
             actions.BuildSettlement(tooClose);
             if (!silent)
             {
                 Console.WriteLine(id + ": Controller allowed a building too close");
             }
         }
         catch (IllegalBuildPositionException e)
         {
             if (!silent)
             {
                 Console.WriteLine(id + ": Controller threw exception as expected: " + e.Message);
             }
         }
         actions.BuildSettlement(start2);
         Console.WriteLine(id + ": Second settlement built succesfully");
         try
         {
             actions.BuildRoad(farRoad);
             if (!silent)
             {
                 Console.WriteLine(id + ": Controller allowed a building disconnected road");
             }
         }
         catch (IllegalBuildPositionException e)
         {
             if (!silent)
             {
                 Console.WriteLine(id + ": Controller threw exception as expected: " + e.Message);
             }
         }
         actions.BuildRoad(new Edge(start2.FirstTile, start2.SecondTile));
         if (!silent)
         {
             Console.WriteLine(id + ": Second road built succesfully");
         }
     }
 }
Exemplo n.º 5
0
        public void PlaceStart(IGameState state, IStartActions actions)
        {
            if (!silent)
                Console.WriteLine(id + ": Place starts");

            var spos = FindBestIntersection(state.Board.GetAllIntersections()
                .Where(i => state.Board.GetPiece(i) == null &&
                    state.Board.HasNoNeighbors(i)), state.Board);

            actions.BuildSettlement(spos);
            actions.BuildRoad(FindBestRoad(spos, state.Board));
        }
Exemplo n.º 6
0
 public void PlaceStart(IGameState state, IStartActions actions)
 {
     if (!silent)
         Console.WriteLine(id + ": Place starts");
     if (!firstStartPlaced)
     {
         firstStartPlaced = true;
         actions.BuildSettlement(start1);
         if (!silent)
             Console.WriteLine(id + ": First settlement built succesfully");
         actions.BuildRoad(new Edge(start1.FirstTile, start1.SecondTile));
         if (!silent)
             Console.WriteLine(id + ": First road built succesfully");
     }
     else
     {
         try
         {
             actions.BuildSettlement(start1);
             if (!silent)
                 Console.WriteLine(id + ": Controller allowed a building on top of another");
         }
         catch (IllegalBuildPositionException e)
         {
             if (!silent)
                 Console.WriteLine(id + ": Controller threw exception as expected: " + e.Message);
         }
         try
         {
             actions.BuildSettlement(tooClose);
             if (!silent)
                 Console.WriteLine(id + ": Controller allowed a building too close");
         }
         catch (IllegalBuildPositionException e)
         {
             if (!silent)
                 Console.WriteLine(id + ": Controller threw exception as expected: " + e.Message);
         }
         actions.BuildSettlement(start2);
         Console.WriteLine(id + ": Second settlement built succesfully");
         try
         {
             actions.BuildRoad(farRoad);
             if (!silent)
                 Console.WriteLine(id + ": Controller allowed a building disconnected road");
         }
         catch (IllegalBuildPositionException e)
         {
             if (!silent)
                 Console.WriteLine(id + ": Controller threw exception as expected: " + e.Message);
         }
         actions.BuildRoad(new Edge(start2.FirstTile,start2.SecondTile));
         if (!silent)
             Console.WriteLine(id + ": Second road built succesfully");
     }
 }