Dominion Strategy Forum

Please login or register.

Login with username, password and session length
Pages: [1]

Author Topic: Request: Rebuild  (Read 6421 times)

0 Members and 1 Guest are viewing this topic.

WanderingWinder

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 5275
  • ...doesn't really matter to me
  • Respect: +4384
    • View Profile
    • WanderingWinder YouTube Page
Request: Rebuild
« on: June 10, 2013, 04:21:25 pm »
+1

I'm really interested in seeing how this card holds up to certain things. There are a few things I'd like to see. Basically, two versions of Rebuild bots to give a baseline of how powerful it is. The first one is probably more important, and that is the non-mirror matchup bot. How does it do against wharf, mountebank, witch, young witch, and if it beats all of them, some of the combos, like YW/Tunnel, HP-terminal silver, HP-baron, etc. etc. The non-mirror would be something like rebuild (if less than say 2)>province>duchy(if late enough)>duchy or estate(if there are say 2 or fewer non-province green cards in your deck)>Rebuild>silver>duchy>estate(if it's reasonably late). Play rules could be as simple as always name province, or name estate if duchies are empty (otherwise name province), or if you want to give more exactitude, some way to be able to trash province->province to end the game sometimes (I doubt this will be very important though).

Also a mirror bot, how to play this optimally. This is probably similar, but you may want to duchy a little more aggressively - or at least, that's what consensus seems, though I'm not sure I see that much of a difference myself...

Sparafucile

  • Thief
  • ****
  • Offline Offline
  • Posts: 98
  • Respect: +153
    • View Profile
Re: Request: Rebuild
« Reply #1 on: June 21, 2013, 08:45:45 pm »
+5

I'm just beginning this one.   Here's some preliminary numbers:


88.46% win for Rebuild
10.28% win for BigMoney
1.26% there is a tie.

63.76% win for Rebuild
33.05% win for BigMoneyWithCard<Wharf>
3.19% there is a tie.

64.66% win for Rebuild
33.01% win for BigMoneyWithCard<Mountebank>
2.33% there is a tie.

48.92% win for Rebuild
48.75% win for BigMoneyWithCard<Witch>
2.33% there is a tie.

40.98% win for Rebuild
57.15% win for BigMoneyWithCard<YoungWitch>
1.87% there is a tie.

Rebuild uses a strategy of buying up to 3 rebuilds.  Rebuild is higher priority buy than gold.  You can consider the "Name a card" to always be province.   I tried variations on the name a card, and they don't impact rankings materially.

The competing strategy is like a big money.  It does buy up to 2 copies of the card being tested. (e.g. up to 2 copies of wharf).  It prioritizes getting these 2 copies over getting gold.  It will get 2 gold before greening.

Here's c# code for the rebuild strategy.
Code: [Select]
            private static CardPickByPriority PurchaseOrder()
            {
                return new CardPickByPriority(
                           CardAcceptance.For<CardTypes.Province>(),
                           CardAcceptance.For<CardTypes.Duchy>(gameState => CountAllOwned<CardTypes.Estate>(gameState) < CountAllOwned<CardTypes.Rebuild>(gameState)),
                           CardAcceptance.For<CardTypes.Estate>(gameState => gameState.GetPile<CardTypes.Province>().Count() <= 2 || gameState.GetPile<CardTypes.Duchy>().Count() == 0),
                           CardAcceptance.For<CardTypes.Rebuild>(gameState => CountAllOwned<CardTypes.Rebuild>(gameState) < 3),
                           CardAcceptance.For<CardTypes.Gold>(),                           
                           CardAcceptance.For<CardTypes.Silver>());
            }

                public override Type NameACard(GameState gameState)
                {
                   
                    PlayerState currentPlayer = gameState.players.CurrentPlayer;
                   
                    if (gameState.GetPile<CardTypes.Duchy>().Count() == 0)
                    {
                        return typeof(CardTypes.Estate);
                    }

                    if (CountMightDraw<CardTypes.Province>(gameState) > 0)
                    {
                        return typeof(CardTypes.Province);
                    }

                    if (CountMightDraw<CardTypes.Estate>(gameState) > 0)
                    {
                        return typeof(CardTypes.Duchy);
                    }                   
                   
                    return typeof(CardTypes.Province);
                }

This is what the competing strategy looks like:
Code: [Select]
private static IGetMatchingCard PurchaseOrder(int cardCount)
            {
                return new CardPickByPriority(
                           CardAcceptance.For<CardTypes.Province>(gameState => CountAllOwned<CardTypes.Gold>(gameState) > 2),
                           CardAcceptance.For<CardTypes.Duchy>(gameState => gameState.GetPile<CardTypes.Province>().Count() < 4),
                           CardAcceptance.For<CardTypes.Estate>(gameState => gameState.GetPile<CardTypes.Province>().Count() < 2),
                           CardAcceptance.For<T>(gameState => CountAllOwned<T>(gameState) < cardCount),
                           CardAcceptance.For<CardTypes.Gold>(),                           
                           CardAcceptance.For<CardTypes.Estate>(gameState => gameState.GetPile<CardTypes.Province>().Count() < 4),
                           CardAcceptance.For<CardTypes.Silver>());

            }

<edit> Fixed mountebank bug</edit>
« Last Edit: June 21, 2013, 09:04:26 pm by Sparafucile »
Logged

ragingduckd

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1059
  • Respect: +3527
    • View Profile
Re: Request: Rebuild
« Reply #2 on: June 21, 2013, 09:21:42 pm »
0

Nice start! Mind if I suggest a few small improvements?

Code: [Select]
CardAcceptance.For<CardTypes.Duchy>(gameState => CountAllOwned<CardTypes.Estate>(gameState) < CountAllOwned<CardTypes.Rebuild>(gameState)),

Does this say to buy Duchies when you own more Rebuilds than Estates? That doesn't sound right. Maybe only buy Estates/Duchies when you're down to 1-2 Estates/Duchies left in your deck.

I doubt you ever want Gold over Rebuild/Duchy. Maybe keep buying Rebuilds until there's 3-4 Provinces left, then prefer Duchies.

Rebuild wants to strategically name Estates vs Province based on the current score. Something like "name Estate when ahead and 1 Province left" and "name Estate when at least 7 pts ahead and 2-3 Provinces left" is a reasonable compromise between simplicity and optimization.

If you try any of these, you'll want to fiddle with the cutoff numbers. I'm just making them up as I go.
Logged
Salvager Extension | Isotropish Leaderboard | Game Data | Log Search & other toys | Salvager Bug Reports

Salvager not working for me at all today. ... Please help! I can't go back to playing without it like an animal!

Sparafucile

  • Thief
  • ****
  • Offline Offline
  • Posts: 98
  • Respect: +153
    • View Profile
Re: Request: Rebuild
« Reply #3 on: June 21, 2013, 10:19:35 pm »
0

Thank you for the suggestions.

Quote
Does this say to buy Duchies when you own more Rebuilds than Estates?

Yes.  That is correct.  I will play with this a little later as you suggested. 

My thinking in the heuristic you pointed out reflects my experience with the card.   You want to buy duchies, only after you have 1 or 2 rebuilds.   You can't reduce your estate count until you have rebuilds - making this an interesting heuristic.   From my playing with the card, I actually greatly prefer converting all of my estates to duchies, before converting any duchies to provinces.   Once the other player starts obtaining duchies, the duchies quickly run out, you lose the ability to convert estates.  At this point rebuild becomes no more than a province pile emptier.   I think the way i've coded it up accomplishes this.  I will try some other things you mention above and see if they improve the Rebuild AI.
Logged

ragingduckd

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1059
  • Respect: +3527
    • View Profile
Re: Request: Rebuild
« Reply #4 on: June 21, 2013, 10:38:58 pm »
0

My thinking in the heuristic you pointed out reflects my experience with the card.   You want to buy duchies, only after you have 1 or 2 rebuilds.   You can't reduce your estate count until you have rebuilds - making this an interesting heuristic.   From my playing with the card, I actually greatly prefer converting all of my estates to duchies, before converting any duchies to provinces.   Once the other player starts obtaining duchies, the duchies quickly run out, you lose the ability to convert estates.  At this point rebuild becomes no more than a province pile emptier.   I think the way i've coded it up accomplishes this.  I will try some other things you mention above and see if they improve the Rebuild AI.

Yes, that all sounds reasonable in the mirror. I expect that a Rebuild bot following my suggestions will do better against Witch-BM, but will lose to a Rebuild bot that runs your current algorithm.
Logged
Salvager Extension | Isotropish Leaderboard | Game Data | Log Search & other toys | Salvager Bug Reports

Salvager not working for me at all today. ... Please help! I can't go back to playing without it like an animal!

ftl

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2056
  • Shuffle iT Username: ftl
  • Respect: +1345
    • View Profile
Re: Request: Rebuild
« Reply #5 on: June 21, 2013, 10:43:44 pm »
0

I do like the demonstration of just how powerful Rebuild is. Rebuild beats BM-mountebank and goes toe to toe with BM-witch, and crushes the best non-attack BM! I mean, I sort of knew it was really good, but it's impressive to see, especially against the cursers.
Logged

Eevee

  • Saboteur
  • *****
  • Offline Offline
  • Posts: 1010
  • Shuffle iT Username: Eevee
  • A wild Eevee appears!
  • Respect: +867
    • View Profile
Re: Request: Rebuild
« Reply #6 on: June 21, 2013, 10:57:13 pm »
0

That's just cray-cray!
Logged

eHalcyon

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 8689
  • Respect: +9187
    • View Profile
Re: Request: Rebuild
« Reply #7 on: June 21, 2013, 11:05:36 pm »
0

I do like the demonstration of just how powerful Rebuild is. Rebuild beats BM-mountebank and goes toe to toe with BM-witch, and crushes the best non-attack BM! I mean, I sort of knew it was really good, but it's impressive to see, especially against the cursers.

Could the competing strategies be tweaked?  Is optimal Witch/MB/Wharf BM getting just two copies of the card, then Gold, etc.?  Can it adjust specifically to the Rebuild strategy by sniping Duchies early?

Still very impressive.
Logged

NoMoreFun

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2012
  • Respect: +2127
    • View Profile
Re: Request: Rebuild
« Reply #8 on: June 22, 2013, 05:45:52 am »
0

Where's this simulator that has Dark Ages cards?
Logged

sudgy

  • Cartographer
  • *****
  • Offline Offline
  • Posts: 3431
  • Shuffle iT Username: sudgy
  • It's pronounced "SOO-jee"
  • Respect: +2707
    • View Profile
Re: Request: Rebuild
« Reply #9 on: June 22, 2013, 09:32:02 am »
0

Where's this simulator that has Dark Ages cards?

Nothing is out, but some people have a few Dark Ages cards on the simulators, so only the owners of the simulators can do anything.
Logged
If you're wondering what my avatar is, watch this.

Check out my logic puzzle blog!

   Quote from: sudgy on June 31, 2011, 11:47:46 pm

WanderingWinder

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 5275
  • ...doesn't really matter to me
  • Respect: +4384
    • View Profile
    • WanderingWinder YouTube Page
Re: Request: Rebuild
« Reply #10 on: June 22, 2013, 10:18:31 am »
0

Where's this simulator that has Dark Ages cards?

Nothing is out, but some people have a few Dark Ages cards on the simulators, so only the owners of the simulators can do anything.
Or anyone who has the time and skills to go write their own.

florrat

  • Minion
  • *****
  • Offline Offline
  • Posts: 542
  • Shuffle iT Username: florrat
  • Respect: +748
    • View Profile
Re: Request: Rebuild
« Reply #11 on: June 22, 2013, 10:57:28 am »
+2

Where's this simulator that has Dark Ages cards?

Nothing is out, but some people have a few Dark Ages cards on the simulators, so only the owners of the simulators can do anything.
Or anyone who has the time and skills to go write their own.
In which case you are the owner of a simulator :)
Logged

Sparafucile

  • Thief
  • ****
  • Offline Offline
  • Posts: 98
  • Respect: +153
    • View Profile
Re: Request: Rebuild
« Reply #12 on: June 22, 2013, 05:06:36 pm »
0

Where's this simulator that has Dark Ages cards?

I've been working on my own in my spare time.   I haven't posted the code anywhere yet, as it's far from complete and buggy still.
Logged

soulnet

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2142
  • Respect: +1751
    • View Profile
Re: Request: Rebuild
« Reply #13 on: June 22, 2013, 06:23:21 pm »
0

I do like the demonstration of just how powerful Rebuild is. Rebuild beats BM-mountebank and goes toe to toe with BM-witch, and crushes the best non-attack BM! I mean, I sort of knew it was really good, but it's impressive to see, especially against the cursers.

Actually, if I understood correctly, the bot is buying up to 2 Wharves, and I don't think that's optimal in general. I think 3 Wharves should do better, unless the game is so fast with Rebuild that it does not make a difference.
Logged

eHalcyon

  • Adventurer
  • ******
  • Offline Offline
  • Posts: 8689
  • Respect: +9187
    • View Profile
Re: Request: Rebuild
« Reply #14 on: June 22, 2013, 06:40:38 pm »
0

I do like the demonstration of just how powerful Rebuild is. Rebuild beats BM-mountebank and goes toe to toe with BM-witch, and crushes the best non-attack BM! I mean, I sort of knew it was really good, but it's impressive to see, especially against the cursers.

Actually, if I understood correctly, the bot is buying up to 2 Wharves, and I don't think that's optimal in general. I think 3 Wharves should do better, unless the game is so fast with Rebuild that it does not make a difference.

Yes.  And I'm still curious if any of the other bots could beat Rebuild by contesting Duchies.
Logged
Pages: [1]
 

Page created in 0.093 seconds with 20 queries.