Dominion Strategy Forum
Dominion => Simulation => Topic started by: MarkowKette on May 03, 2014, 08:48:50 am
-
I want to simulate Hermit-Feodum BM
Strategy:
Get 2 Hermits to trash your estates and Feoda and gain Silvers (3rd one when your deck is more than 20 cards)
and gain Hermit with Hermit whenever you only have a < $3 hand (and turn the played hermit into a madman)
Buy Feodum when you have more than 9 silver or when you have a Hermit coming up before the next reshuffle (with at least 80% chance)
( hermits left in draw pile >0 && cards left in drawpile [mod 5] / cards left in draw pile <= 0,2)
-Trash Feodum over Estate, but only trash Feodum if you trashed 2 or less Feoda so far.
-Buy Province over Feodum when you have less than 18 Silver.
-Buy silver on all other turns .
My knowledge in coding for the simulator isn't enough to do that.
Can you help me?
-
In Dominiate:
1) Wait until someone implemented Hermit
2) ...
3) profit
-
but when this happened, it should look something like
obviously not tested, and almost surely with some syntax error
gainPriority: (state, my) -> [
#Province over Feodum if less than 18 Silvers
"Province" if my.countInDeck("Silver") < 18
#Feodum if more than 9 Silvers in deck
"Feodum" if my.countInDeck("Silver") > 9
#Feodum if you have a Hermit coming up before the next reshuffle
#actually, my.countInDraw($card) does not exists, see below at my.countInTrash("") how to (maybe) write it yourself
"Feodum" if my.countInDraw("Hermit") > 0 and (my.draw.length mod 5)/my.draw.length < 0.2
#gains Hermit if less than 2 Hermits in deck
"Hermit" if my.countInDeck("Hermit") < 2
#gains Hermit if less than 3 Hermits and deck and at least 20 cards in deck
"Hermit" if my.countInDeck("Hermit") < 3 and my.numCardsInDeck() >= 20
#allows for gaining Hermits from Hermits when less than $3 in hand
"Hermit" if state.phase == "action" and my.getAvailableMoney() < 3
#gain Silver from Hermits
"Silver" if state.phase == "action"
#I guess you also want Silver in buy phase
"Silver"
#prevents from buying anything when less then 3 coins, not necessary but could gain cards with Hermit costing less than 3 below this
none if my.coins < 3 and state.phase = "buy"
]
#so now to the trash rules
trashPriority: (state, my) -> [
#trash Feodum if less than 2 Feodums trashed so far
#this one is a bit tricky, you could count Feodums in trash, but could have been trashed by opponent. This should be:
#"Feodum" if state.countInTrash("Feodum") < 2
#but actually countInTrash($card) does not seem to exist (though it should), so you have to write it yourself
#on the other hand, once I have written it, I should just push it anyway, so countInTrash($card) would exists
#which would mean I don't need to write it down here
#I think I'm getting lost in recursion...
#this is absolutely not tested
"Feodum" if (card for card in state.trash where card == c.Feodum).length <= 2
# don't put Estates here, as it's already in the default list, which should be called at the end of this one
# so you don't have to think about a heuristic of when to trash Estates
# in case you want to have complete control on when to trash what, write it out here and end with
# none
# to prevent a call to the default list.
]
-
Here's the solution in dominulator:
public class HermitFeodum
: Strategy
{
public static PlayerAction Player()
{
return new PlayerAction(
"HermitFeodum",
purchaseOrder: PurchaseOrder(),
actionOrder: ActionOrder(),
trashOrder: TrashOrder(),
gainOrder: GainOrder(),
chooseDefaultActionOnNone:false);
}
private static ICardPicker PurchaseOrder()
{
return new CardPickByPriority(
CardAcceptance.For(Cards.Province, gameState => CountAllOwned(Cards.Silver, gameState) < 18 || CountOfPile(Cards.Feodum, gameState) == 0 ),
CardAcceptance.For(Cards.Feodum, ShouldGainFeodum),
// open up double hermit
CardAcceptance.For(Cards.Hermit, gameState => CountAllOwned(Cards.Silver, gameState) == 0 && CountAllOwned(Cards.Hermit, gameState) < 2),
CardAcceptance.For(Cards.Silver));
}
private static ICardPicker GainOrder()
{
return new CardPickByPriority(
CardAcceptance.For(Cards.Hermit, gameState => gameState.Self.ExpectedCoinValueAtEndOfTurn < 3),
CardAcceptance.For(Cards.Silver),
CardAcceptance.For(Cards.Estate));
}
private static CardPickByPriority ActionOrder()
{
return new CardPickByPriority(
CardAcceptance.For(Cards.Madman),
CardAcceptance.For(Cards.Hermit));
}
private static CardPickByPriority TrashOrder()
{
return new CardPickByPriority(
CardAcceptance.For(Cards.Feodum, ShouldTrashFeodum),
CardAcceptance.For(Cards.Estate),
CardAcceptance.For(Cards.Copper));
}
private static bool ShouldTrashFeodum(GameState gameState)
{
int countSilvers = CountAllOwned(Cards.Silver, gameState);
int countFeodum = CountAllOwned(Cards.Feodum, gameState);
// if you have trashed 2 or less feodum, you should have less than 9 silvers.
if (countSilvers < 8)
{
return true;
}
// otherwise maximize feodum points
int scoreTrashNothing = CardTypes.Feodum.VictoryCountForSilver(countSilvers) * countFeodum;
int scoreTrashFeodum = CardTypes.Feodum.VictoryCountForSilver((countSilvers + 4)) * (countFeodum - 1);
return scoreTrashFeodum > scoreTrashNothing;
}
private static bool ShouldGainFeodum(GameState gameState)
{
int countSilvers = CountAllOwned(Cards.Silver, gameState);
if (countSilvers > 9)
{
return true;
}
//hermits left in draw pile >0 && cards left in drawpile [mod 5] / cards left in draw pile <= 0,2
bool hasHermitInDrawPile = CountInDeck(Cards.Hermit, gameState) > 0;
bool atLeast80PercentChanceOfDrawingBeforeShuffle = (((double)(gameState.Self.CardsInDeck.Count % 5)) / gameState.Self.CardsInDeck.Count) < 0.2;
if (hasHermitInDrawPile && atLeast80PercentChanceOfDrawingBeforeShuffle)
return true;
return false;
}
}
Attached is a full HTML report of how the strategy compares to BigMoney. It wins 90% of the games as coded.
There is one added heuristic that you didn't request. The strategy will trash a feodum if it increases the total point value.
I may not have coded exactly what you were looking for. Let me know if u want any changes.
-
Simulation is fun :) This strategy combo is near the top of the ones I have written so far. I especially like how it smashes ill gottens gains ;)
This is the difference in win%. The strategies > 0 did better than HermitFeodum. The others did worse.
64.0% difference for GardensBeggarIronworks
59.6% difference for RebuildMonument
57.3% difference for RatsWanderingMinstrelWatchtowerArmory
43.2% difference for KingsCourtRabbleExpandFarmingVillage
33.8% difference for RebuildJack
30.1% difference for HermitMarketSquare
17.5% difference for RebuildAdvanced
11.7% difference for LookoutSalvagerLibraryHighwayFestival
9.8% difference for FishingVillageChapelPoorHouse
4.3% difference for CaravanBridgeDukeCartographer
=====>
-2.1% difference for HermitFeodum
-6.7% difference for BigMoneyCultist
-16.7% difference for BigMoneyColony
-17.3% difference for MountebankMonumentHamletVineyard
-18.2% difference for Rebuild
-19.4% difference for EmbassyTunnelSpiceMerchantPlaza
-20.6% difference for FishingVillageChapelPoorHouseTalisman
-20.9% difference for FishingVillageLibraryCountPoorHouse
-28.3% difference for AmbassadorCaravanApprenticeMerchantGuild
-30.7% difference for RebuildDuke
-31.6% difference for FeodumDevelop
-34.6% difference for BigMoneyCouncilRoomEarlyProvince
-35.8% difference for BigMoneyFishingVillageJack
-38.1% difference for BigMoneyWharf
-40.4% difference for NomadCampLaboratorySpiceMerchantWarehouse
-41.3% difference for AmbassadorCaravanLaboratory
-42.2% difference for BigMoneySingleJack
-44.2% difference for FishingVillageJackLookout
-46.4% difference for BigMoneyDoubleSmithy
-46.5% difference for BigMoneyDoubleWitch
-46.7% difference for BigMoneySingleSmithy
-48.5% difference for BigMoneyDoubleJack
-50.1% difference for LaboratorySpiceMerchantWarehouse
-52.3% difference for DuchyDukeWarehouseEmbassy
-55.5% difference for BigMoneySmithyEarlyProvince
-57.3% difference for BigMoneyDoubleJackSlog
-59.4% difference for MineHoard
-60.3% difference for BigMoneySingleWitch
-60.4% difference for CacheCountingHouseBridgeTunnel
-63.3% difference for RemakeSoothsayer
-63.7% difference for TreasureMapDoctor
-64.4% difference for LookoutTraderNobles
-65.8% difference for ButcherPlazaWatchtower
-67.5% difference for TreasureMap
-67.8% difference for RatsUpgradeBazaar
-69.6% difference for MintBaker
-70.3% difference for DevelopFeastMysticTunnel
-70.7% difference for Doctor
-70.8% difference for BigMoneyBridge
-71.0% difference for ArmoryConspiratorForagerGreatHall
-71.7% difference for TaxMan
-73.2% difference for HorseTraderSoothsayerMinionGreatHall
-74.2% difference for LookoutHaremMiningVillageMysticScout
-75.3% difference for BigMoneyMoneylender
-76.0% difference for DoubleWarehouse2
-77.6% difference for DoubleWarehouse
-79.2% difference for BigMoneyThief
-79.5% difference for DeathCartDoubleWarehouse
-81.1% difference for RatsUpgrade
-82.5% difference for BigMoney
-82.5% difference for Harem
-84.5% difference for MountebankGovernorMaurader
-85.2% difference for BigMoneyDelayed
-88.0% difference for Lookout
-88.5% difference for FamiliarPotionSilverOpenning
-88.7% difference for IronworksGreathallRemodelHuntingGrounds
-89.9% difference for ProcessionGraverobber
-92.8% difference for FamiliarSilverSilverOpenning
-94.2% difference for BigMoneySimple
-97.1% difference for GovernorMarketsquare
-98.0% difference for IllgottengainsMoneylender
-98.4% difference for Illgottengains
-100.0% difference for ChapelCanTripKingsCourtMasquerade
-100.0% difference for GovernorJunkdealer
-100.0% difference for MountebankHoard