示例#1
0
		private static VariantOffer CheckBuildAndMoveNavy(Context context, PlayerInfoCM player, AIOptions options, int restOfGold)
		{
			VariantOfferPackage package = new VariantOfferPackage();

			int restUnits = Math.Min(Constants.maxArmyCount - context.map.Navy.Where(e => e.OwnerID == player.ID).Count(), Constants.armyPrices.Count);
			if (restUnits < 1)
				return null;

			List<IslandCM> enemyNeibourIslands = Library.Map.GetEnemyNeibourIslands(context.map, player.ID, false);
			float maxNeedBridgeVP = 0;
			for (int i = 0; i < enemyNeibourIslands.Count; ++i)
			{
				IslandCM enemyIsland = enemyNeibourIslands[i];
				float vp = Library.Map.GetIslandPriceVP(context.map, enemyIsland.ID, player.ID, options) * options.coefficients.BridgeToIslandPriceCoeff;
				if (vp > maxNeedBridgeVP)
					maxNeedBridgeVP = vp;
			}

			if (maxNeedBridgeVP > 0)
				package.Add(new VariantOffer(0, maxNeedBridgeVP));

			if (Library.Map.GetAccessibleSeaHorns(context.map, player.ID, false, false).Count > 0)
				package.Add(new VariantOffer(Constants.moveNavyCost + Constants.navyPrices[1], options.coefficients.HornVPT * options.turnsToEnd));

			return package.GetSum();
		}
示例#2
0
		private static VariantOffer CheckNeedBuild(Context context, PlayerInfoCM player, AIOptions options, int restOfGold)
		{
			VariantOfferPackage package = new VariantOfferPackage();

			package.Add(AuctionCommon.CheckNeedBuild(context, player, options, Build.Poseidon, restOfGold));

			package.CheckAll(options);
			return package.GetAvg();
		}
示例#3
0
		private static VariantOffer CheckNeedBuild(Context context, PlayerInfoCM player, AIOptions options, int restOfGold)
		{
			VariantOfferPackage package = new VariantOfferPackage();

			package.Add(AuctionCommon.CheckNeedBuild(context, player, options, Build.Zeus, restOfGold));

			if (restOfGold >= Cyclades.Constants.buildingCost)
				package.Add(new VariantOffer(Cyclades.Constants.buildingCost, options.coefficients.TempleVPT * options.turnsToEnd));

			package.CheckAll(options);
			return package.GetAvg();
		}
示例#4
0
		public AIVariant Choose(List<AIVariant> variants, AIOptions options)
		{
			VariantOfferPackage packadge = new VariantOfferPackage();
			for (int i = 0; i < variants.Count; ++i)
			{
				if (variants[i] != null && variants[i].offer != null)
					packadge.Add(variants[i].offer);
			}
			packadge.CheckAll(options);
			VariantOffer theBestOffer = packadge.GetTheBestOne(options);
			
			if (theBestOffer == null)
				throw new Exception("AI: No variants to choose");

			return variants.Where(e => e.offer == theBestOffer).First();
		}
示例#5
0
		public static void AddVariant(AIVariantPackage variants, Context context, PlayerInfoCM player, AIOptions options, int minBetGold)
		{
			AIAuctionVariant variant = new AIAuctionVariant(God.Poseidon, minBetGold + player.Priests);

			int restOfGold = player.Gold - minBetGold;
			VariantOfferPackage offers = new VariantOfferPackage();

			offers.Add(CheckNeedBuild(context, player, options, restOfGold));
			offers.Add(CheckBuildAndMoveNavy(context, player, options, restOfGold));

			offers.CheckAll(options);
			VariantOffer offer = offers.GetTheBestSumWithCostLimit(restOfGold);
			offer.cost += minBetGold;
			variant.offer = offer;

			variants.AddVariant(variant);
		}
示例#6
0
		private static VariantOffer CheckPhilosopher(Context context, PlayerInfoCM player, AIOptions options, int restOfGold)
		{
			VariantOfferPackage package = new VariantOfferPackage();

			for (int i = 0; i < Cyclades.Constants.philosopherPrices.Count; ++i)
			{
				int cost = Cyclades.Constants.philosopherPrices[i];
				if (cost > restOfGold)
					break;

				package.Add(new VariantOffer(cost, options.coefficients.PhilosopherVP));

				restOfGold -= cost;
			}

			package.CheckAll(options);
			return package.GetSum();
		}