Dominion Strategy Forum

Please login or register.

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

Author Topic: Dominulator: A flexible dominion engine simulator  (Read 18613 times)

0 Members and 1 Guest are viewing this topic.

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #25 on: October 15, 2013, 03:09:52 pm »
+1

Philosopher's Stone:

Code: [Select]
    public class PhilosophersStone
       : Card
    {
        public static PhilosophersStone card = new PhilosophersStone();

        private PhilosophersStone()
            : base("PhilosophersStone", coinCost: 3, potionCost:1, isTreasure: true)
        {
        }

        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            int stoneValue = currentPlayer.CardsInDeckAndDiscard.Count() / 5;           
            currentPlayer.AddCoins(stoneValue);   
        }
    }
Logged

Sparafucile

  • Thief
  • ****
  • Offline Offline
  • Posts: 98
  • Respect: +153
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #26 on: October 15, 2013, 03:30:23 pm »
0

Thx for mentioning the issue you found while implementing fortress.  The solution you came up with is ok for fortress, but the problem you mentioned was actually system with all cards that had an effect on trashing.   Check out the change I pushed up.  You can see how I fixed the problem so that it would fix all cards.   I haven't actually tried the fix, so let me know if there are further issues with it.

Also, pushed up the philosophers stone implementation.
« Last Edit: October 15, 2013, 03:34:53 pm by Sparafucile »
Logged

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #27 on: October 17, 2013, 05:38:33 am »
0

It seems to work fine!

I'm trying to implement the on buy effect of Mint (which the code didn't mention as missing):

Code: [Select]
public override void DoSpecializedWhenBuy(PlayerState currentPlayer, GameState gameState)
        {
            foreach (Card card in currentPlayer.cardsInPlay)
            {
                if (card.isTreasure)
                {
                    currentPlayer.cardsInPlay.RemoveCard(card);
                    currentPlayer.MoveCardToTrash(card, gameState);
                }
            }
        } 

However, this trashes only part of the treasures, and I can't figure out what's going wrong:

Quote
BigMoney ends turn with deck: Copper(7), Estate(3), Silver(2)

BigMoney begins turn
With hand: Copper,Copper,Copper,Silver,Silver,
  BigMoney Played Silver.
    +2 Coin = 2 all together.
  BigMoney Played Silver.
    +2 Coin = 4 all together.
  BigMoney Played Copper.
    +1 Coin = 5 all together.
  BigMoney Played Copper.
    +1 Coin = 6 all together.
  BigMoney Played Copper.
    +1 Coin = 7 all together.
  BigMoney bought Mint.
    BigMoney trashed Copper.
    BigMoney trashed Copper.
    BigMoney trashed Silver.
  BigMoney Discarded Copper.
  BigMoney Discarded Copper.
  BigMoney Discarded Copper.
  BigMoney Discarded Silver.
  BigMoney Discarded Silver.
  BigMoney Drew Estate into hand.
  BigMoney Drew Estate into hand.
  BigMoney Drew Estate into hand.
  BigMoney Drew Copper into hand.
  BigMoney Drew Copper into hand.
  BigMoney ends turn with deck: Copper(5), Estate(3), Mint(1), Silver(1),

(I had to comment out the content of Mint's DoSpecializedAction method to get it to work at all, as the RequestPlayerRevealCardFromHand doesn't seem to function yet.)
Logged

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #28 on: October 17, 2013, 07:36:11 am »
0

I implemented Tactician but I'm not sure whether it's the right way, as I had to modify the PlayerState to keep track of the number of "activated" Tacticians (it is possible to activate more than one in some rare circumstances), as doing it via a bool within the Tactician class itself resulted in some very weird behavior when you played a Tactician a few turns in a row. I'm guessing that because it's a static class, the Tacticians don't really exist as individual copies where each could possibly contain a different value of a bool?

Code: [Select]
public class Tactician
       : Card
    {
        public static Tactician card = new Tactician();

        private Tactician()
            : base("Tactician", coinCost: 5, isAction: true, isDuration: true)
        {
        }

        public override void DoSpecializedDurationActionAtBeginningOfTurn(PlayerState currentPlayer, GameState gameState)
        {
            if (currentPlayer.ActivatedTacticians > 0)
            {
                currentPlayer.DrawAdditionalCardsIntoHand(5);
                currentPlayer.AddBuys(1);
                currentPlayer.AddActions(1);
                currentPlayer.RemoveTactician(1);
            }
        }

        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {           
            if (currentPlayer.hand.Count() > 0)
            {
                currentPlayer.DiscardHand(gameState);
                currentPlayer.AddTactician(1);
            }
        }
    }

Additions to PlayerState.cs:

Code: [Select]
public int ActivatedTacticians { get { return this.turnCounters.ActivatedTacticians; } }

internal void AddTactician(int coinAmount)
        {
            this.turnCounters.AddTactician(this, coinAmount);
        }

        internal void RemoveTactician(int coinAmount)
        {
            this.turnCounters.RemoveTactician(this, coinAmount);
        }

Additions to PlayerTurnCounters.cs:

Code: [Select]
private int activatedTacticians = 0;

internal int ActivatedTacticians
        {
            get
            {
                return this.activatedTacticians;
            }

        }

        public void AddTactician(PlayerState playerState, int count)
        {
            if (count > 0)
            {
                this.activatedTacticians += count;
            }
        }

        internal void RemoveTactician(PlayerState playerState, int count)
        {
            this.activatedTacticians -= count;
            if (this.activatedTacticians < 0)
            {
                this.activatedTacticians = 0;
            }
        }
« Last Edit: October 17, 2013, 07:48:12 am by SheCantSayNo »
Logged

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #29 on: October 17, 2013, 08:00:58 am »
0

I noticed a mistake in the Vineyard definition:

Quote
private Vineyard()
            : base("Vineyard", coinCost: 0, potionCost:1, isAction: true, victoryPoints: playerState => playerState.AllOwnedCards.Where(card => card.isAction).Count()/3)

Vineyard is not an action!
       
Logged

rrwoods

  • Navigator
  • ****
  • Offline Offline
  • Posts: 72
  • Respect: +32
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #30 on: October 17, 2013, 08:03:52 am »
0

It seems to work fine!

I'm trying to implement the on buy effect of Mint (which the code didn't mention as missing):

Code: [Select]
public override void DoSpecializedWhenBuy(PlayerState currentPlayer, GameState gameState)
        {
            foreach (Card card in currentPlayer.cardsInPlay)
            {
                if (card.isTreasure)
                {
                    currentPlayer.cardsInPlay.RemoveCard(card);
                    currentPlayer.MoveCardToTrash(card, gameState);
                }
            }
        } 

However, this trashes only part of the treasures, and I can't figure out what's going wrong:

Quote
BigMoney ends turn with deck: Copper(7), Estate(3), Silver(2)

BigMoney begins turn
With hand: Copper,Copper,Copper,Silver,Silver,
  BigMoney Played Silver.
    +2 Coin = 2 all together.
  BigMoney Played Silver.
    +2 Coin = 4 all together.
  BigMoney Played Copper.
    +1 Coin = 5 all together.
  BigMoney Played Copper.
    +1 Coin = 6 all together.
  BigMoney Played Copper.
    +1 Coin = 7 all together.
  BigMoney bought Mint.
    BigMoney trashed Copper.
    BigMoney trashed Copper.
    BigMoney trashed Silver.
  BigMoney Discarded Copper.
  BigMoney Discarded Copper.
  BigMoney Discarded Copper.
  BigMoney Discarded Silver.
  BigMoney Discarded Silver.
  BigMoney Drew Estate into hand.
  BigMoney Drew Estate into hand.
  BigMoney Drew Estate into hand.
  BigMoney Drew Copper into hand.
  BigMoney Drew Copper into hand.
  BigMoney ends turn with deck: Copper(5), Estate(3), Mint(1), Silver(1),

(I had to comment out the content of Mint's DoSpecializedAction method to get it to work at all, as the RequestPlayerRevealCardFromHand doesn't seem to function yet.)
You're removing elements from the same collection you're iterating over. Unless I'm mistaken this is basically guaranteed to result in undefined behavior.
Logged

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #31 on: October 17, 2013, 08:37:14 am »
0

Copying the initial play area to a new variable and iterating over that one while removing the cards from the actual play area results in the same behavior :(
Logged

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #32 on: October 17, 2013, 09:18:13 am »
0

Golem: it works but instead of asking the player in what order to play the actions, it just plays them in the order they are revealed. I'm still trying to figure out how that should be done.

Code: [Select]
public class Golem
       : Card
    {
        public static Golem card = new Golem();

        private Golem()
            : base("Golem", coinCost: 4, potionCost: 1, isAction: true)
        {
        }

        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            Card actionOne, actionTwo = null;
            gameState.gameLog.PushScope();
            while (true)
            {
                actionOne = currentPlayer.DrawAndRevealOneCardFromDeck();
                if (actionOne == null)
                    break;

                if (actionOne.isAction && actionOne.name != "Golem")
                {
                    while (true)
                    {
                        actionTwo = currentPlayer.DrawAndRevealOneCardFromDeck();
                        if (actionTwo == null)
                            break;

                        if (actionTwo.isAction && actionTwo.name != "Golem")
                            break;
                    }
                    break;
                }
            }

            currentPlayer.MoveRevealedCardsToDiscard(cardToMove => !cardToMove.Equals(actionOne)
                && !cardToMove.Equals(actionTwo), gameState);
            gameState.gameLog.PopScope();

            if (actionOne != null && actionTwo != null)
            {
                //TODO: Ask player for play order
                currentPlayer.cardsBeingRevealed.RemoveCard(actionOne);
                currentPlayer.DoPlayAction(actionOne, gameState);

                currentPlayer.cardsBeingRevealed.RemoveCard(actionTwo);
                currentPlayer.DoPlayAction(actionTwo, gameState);
            }

            if (actionOne != null ^ actionTwo != null)
            {
                Card actionCard = actionOne != null ? actionOne : actionTwo;
                currentPlayer.cardsBeingRevealed.RemoveCard(actionCard);
                currentPlayer.DoPlayAction(actionCard, gameState);
            }
        }
    }
Logged

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #33 on: October 17, 2013, 12:51:21 pm »
0

I don't think the Wishing Well implementation is correct:

Quote
        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {
            Card cardType = currentPlayer.GuessCardTopOfDeck(gameState);

            Card revealedCard = currentPlayer.DrawAndRevealOneCardFromDeck();
            if (revealedCard != cardType)
            {
                currentPlayer.MoveAllRevealedCardsToHand();
            }

The "!=" should be "==".

Quote
  else
            {
                currentPlayer.MoveRevealedCardsToDiscard(gameState);
            }
        }
    }

The card shouldn't be discarded, but returned to the top of the deck.
Logged

Sparafucile

  • Thief
  • ****
  • Offline Offline
  • Posts: 98
  • Respect: +153
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #34 on: October 17, 2013, 03:53:51 pm »
+1

Thanks for all the great contributions.  I have made the following changes:

  • Fixed Vineyard to not be an action
  • Fixed Wishing Well to put card back on top of deck, and fixed the comparison from != to ==
  • Added golem implementation
  • Added tactician implmentation
  • Fixed mint to trash treasures in play when bought

The reason your mint implemenation wasn't working as expected was because you were modifying a list which is computed automatically.  CardsPlayed contains Duration cards plus cards in the play area.   You wanted to remove a card from the play area.  Sorry for the naming confusion.

I modified your tactician and golem implementations a little.  I haven't tested any of them ;)  So let me know if there are issues.
Logged

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #35 on: October 18, 2013, 04:50:00 am »
0

When compiling I get the error:

Quote
Error   1   'Program.PlayerAction.ChooseCardToPlayFirst(Dominion.GameState, Dominion.Card, Dominion.Card)': no suitable method found to override   C:\Google Drive\Dominion\Dominulator-master\TestProgram\PlayerAction.cs   69

Commenting out the mentioned override makes it run, and all the cards seem to work :)
« Last Edit: October 18, 2013, 05:07:21 am by SheCantSayNo »
Logged

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #36 on: October 18, 2013, 06:07:14 am »
0

Pillage: it now discards a good card from the other player's hand.

Code: [Select]
    public class Pillage
      : Card
    {
        public static Pillage card = new Pillage();

        private Pillage()
            : base("Pillage", coinCost: 5, isAction: true, attackDependsOnPlayerChoice: true, requiresSpoils:true)
        {
        }

        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {           
            currentPlayer.MoveCardFromPlayToTrash(gameState);

            PlayerState.AttackAction attackAction = delegate(PlayerState currentPlayer2, PlayerState otherPlayer, GameState gameState2)
            {
                if (otherPlayer.Hand.Count >= 5)
                {
                    otherPlayer.RevealHand();
                    Card cardType = currentPlayer2.actions.GetCardFromOtherPlayersHandToDiscard(gameState2, otherPlayer);                   
                    if (!otherPlayer.Hand.HasCard(cardType))
                    {
                        throw new Exception("Must discard a card from the revealed hand");
                    }
                    otherPlayer.DiscardCardFromHand(gameState2, cardType);
                }
            };
            currentPlayer.AttackOtherPlayers(gameState, attackAction);

            currentPlayer.GainCardsFromSupply(gameState, Cards.Spoils, 2);
        }       
    }
Logged

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #37 on: October 18, 2013, 11:17:48 am »
0

Treasury: you're now able to top-deck it if no victory card was bought.

Code: [Select]
public class Treasury
       : Card
    {
        public static Treasury card = new Treasury();

        private Treasury()
            : base("Treasury", coinCost: 5, isAction: true, plusActions: 1, plusCards: 1, plusCoins: 1)
        {
            this.doSpecializedCleanupAtStartOfCleanup = DoSpecializedCleanupAtStartOfCleanup;
        }

        private new void DoSpecializedCleanupAtStartOfCleanup(PlayerState currentPlayer, GameState gameState)
        {
            if (!currentPlayer.CardsBoughtThisTurn.AnyWhere(card => card.isVictory))
            {
                currentPlayer.RequestPlayerTopDeckCardsFromPlay(gameState,
                acceptableCard => acceptableCard == Treasury.card,
                isOptional: true);
            }           
        }
    }

Treasury and Smugglers require the following additions to PlayerTurnCounters.cs:

Quote
internal SetOfCards cardsBannedFromPurchase;
   internal SetOfCards cardsBoughtThisTurn;
        internal SetOfCards cardsGainedThisTurn;

        internal int copperAdditionalValue = 0;

        internal PlayerTurnCounters(CardGameSubset gameSubset)
        {
            cardsBannedFromPurchase = new SetOfCards(gameSubset);
            cardsBoughtThisTurn = new SetOfCards(gameSubset);
            cardsGainedThisTurn = new SetOfCards(gameSubset);

        }

        internal void InitializeTurn()
        {
            this.availableActionCount = 1;
            this.availableBuys = 1;
            this.buysUsed = 0;
            this.availableCoins = 0;
            this.availablePotions = 0;
            this.copperAdditionalValue = 0;
            this.cardsBannedFromPurchase.Clear();
            this.cardsBoughtThisTurn.Clear();
            this.cardsGainedThisTurn.Clear();

        }

PlayerState.cs:

Code: [Select]
        public SetOfCards CardsBoughtThisTurn { get { return this.turnCounters.cardsBoughtThisTurn; } }
        public SetOfCards CardsGainedThisTurn { get { return this.turnCounters.cardsGainedThisTurn; } }

To the method "internal void GainCard" in PlayerState.cs:

           
Quote
if (gainReason == GainReason.Buy)
            {
                card.DoSpecializedWhenBuy(this, gameState);
                this.turnCounters.cardsBoughtThisTurn.Add(card);
            }

            if (this == gameState.players.CurrentPlayer)
            {
                this.turnCounters.cardsGainedThisTurn.Add(card);
            }
Logged

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #38 on: October 18, 2013, 11:23:29 am »
0

Smugglers:

Code: [Select]
    public class Smugglers
       : Card
    {
        public static Smugglers card = new Smugglers();

        private Smugglers()
            : base("Smugglers", coinCost: 3, isAction: true)
        {
        }

        public override void DoSpecializedAction(PlayerState currentPlayer, GameState gameState)
        {           
            Card smuggledCard = null;

            var smuggleTargets = gameState.players.PlayerRight.CardsGainedThisTurn.Where(card =>
                card.CurrentCoinCost(currentPlayer) <= 6 && card.potionCost == 0 && gameState.CardGameSubset.HasCard(card));

            if (smuggleTargets.Count() == 1)
            {
                smuggledCard = currentPlayer.GainCardFromSupply(gameState, smuggleTargets.First());               
            }

            if (smuggleTargets.Count() > 1)
            {
                smuggledCard = currentPlayer.RequestPlayerGainCardFromSupply(gameState, card => smuggleTargets.Contains(card),
                    "Choose a card to smuggle", isOptional: false);
            }
        }
    }

I discovered a very weird bug with Smugglers, though. When I circumvent the NotImplemented exception by letting it always smuggle the first card of smuggleTargets and I run a BigMoney variant that buys Smugglers against RebuildAdvanced, I get a NotImplemented exception originating from the RebuildAdvanced strategy(!?) when it plays a Rebuild the turn after the Smugglers player could potentially choose between multiple cards to Smuggle, even though the smuggling itself went completely fine.
Logged

Sparafucile

  • Thief
  • ****
  • Offline Offline
  • Posts: 98
  • Respect: +153
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #39 on: October 18, 2013, 01:26:32 pm »
0

Thx for the implementations.  We are getting close to first pass completion of the cards!

  • Modified pillage to remove the todo  (the change was a lot simpler actually ;) )
  • Submitted implementation for smugglers and treasury

Quote
I run a BigMoney variant that buys Smugglers against RebuildAdvanced, I get a NotImplemented exception

The bigmoney variant that plays with a single card has very default action order.  It plays whatever actions is has.   When playing smugglers vs rebuild, the smugglers player is picking up a rebuild card.    However, we haven't implemented a default "NameACard" method in PlayerAction.  Every strategy that knew it was going to obtain a rebuild card has a customized "NameACard" method avoiding the exception.     

I think our eventual goal should be that for every possible decision a player might make, the default strategy does something not too bad.  (similar to Geronimos approach).  Players can customize specifics if they want to achieve better.   Right now, we don't have defaults for everything (like Rebuild NameACard), which can cause these exceptions if a specific method isnt implemented.
Logged

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #40 on: October 20, 2013, 12:19:12 pm »
0

Thx for the implementations. We are getting close to first pass completion of the cards!

Yay!

I've tried to make a start with Band of Misfits. My idea was to request a supply card "misfitTarget" that is both an action and costs less than this.CurrentCoinCost, and then to copy all it's properties (e.g. this.isDuration = misfitTarget.isDuration, this.isAttack = misfitTarget.isAttack; there should be a way to do all these at once? Maybe just "this = misfitTarget;"?) and then to reset them upon the card leaving play, but the two main problems with that are:

1) All those properties are currently set to be read-only, and I don't want to make any non-minimal changes to the game-engine until I feel I have completely mastered how it works, and certainly not without first discussing them with you.

2) I'm still not sure whether the cards are actually instantiated, and if they are not any change applied to one copy of Band of Misfits will be applied to all of them, which is certainly not what you want.

Quote
The bigmoney variant that plays with a single card has very default action order.  It plays whatever actions is has.   When playing smugglers vs rebuild, the smugglers player is picking up a rebuild card.    However, we haven't implemented a default "NameACard" method in PlayerAction.  Every strategy that knew it was going to obtain a rebuild card has a customized "NameACard" method avoiding the exception.     

I think our eventual goal should be that for every possible decision a player might make, the default strategy does something not too bad.  (similar to Geronimos approach).  Players can customize specifics if they want to achieve better.   Right now, we don't have defaults for everything (like Rebuild NameACard), which can cause these exceptions if a specific method isnt implemented.

Ah yes, good. Right now I think different cards (like Rebuild and Doctor) use the same NameACard method, so that if you want to use both cards in a strategy you have to write one override and make its choices conditional on which card is currently being played, which is very cumbersome and it shouldn't be too hard  to just make card-specific methods with card-specific defaults. If you can design and implement a proper structure for this (preferably with at least one example), I'm more than happy to implement a bunch of reasonable defaults (like the one from RebuildAdvanced, which I think is about as close to optimal as possible on this level of specification).
Logged

flies

  • Minion
  • *****
  • Offline Offline
  • Posts: 629
  • Shuffle iT Username: flies
  • Statistical mechanics of hard rods on a 1D lattice
  • Respect: +348
    • View Profile
    • ask the atheists
Re: Dominulator: A flexible dominion engine simulator
« Reply #41 on: October 20, 2013, 02:10:02 pm »
0

I've tried to make a start with Band of Misfits. My idea was to request a supply card "misfitTarget" that is both an action and costs less than this.CurrentCoinCost, and then to copy all it's properties (e.g. this.isDuration = misfitTarget.isDuration, this.isAttack = misfitTarget.isAttack; there should be a way to do all these at once? Maybe just "this = misfitTarget;"?) and then to reset them upon the card leaving play, but the two main problems with that are:

1) All those properties are currently set to be read-only, and I don't want to make any non-minimal changes to the game-engine until I feel I have completely mastered how it works, and certainly not without first discussing them with you.

2) I'm still not sure whether the cards are actually instantiated, and if they are not any change applied to one copy of Band of Misfits will be applied to all of them, which is certainly not what you want.
can you create a new card (the copied card) and play that, then have BoM trashdelete it when it leaves play?  This effectively puts two cards in play, which might create weird behavior in some cases?  You'd have to do things like check if the spawned card has been trashed and then trash BoM in that case....
« Last Edit: October 20, 2013, 02:44:15 pm by flies »
Logged
Gotta be efficient when most of your hand coordination is spent trying to apply mascara to your beard.
flies Dominionates on youtube

Sparafucile

  • Thief
  • ****
  • Offline Offline
  • Posts: 98
  • Respect: +153
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #42 on: October 20, 2013, 06:29:51 pm »
0

Cards are immutable.  You can't change them by design.   This does cause some inconveniences for Band of Misfits.   I put in a beginning skeleton of how we can handle this card.   The idea is that while the card is in play, I am passing the band of misfits around, but also the card to play it as.  This covers common usage of the card and I believe covers the case like Feast where the card trashes itself.   It doesn't cover a lot of other edge cases though - ssee the comments on Band Of Misfits.    Similar techniques should be able to be worked in to cover the remaining edge cases.  We should be able to pass around the effect to be used during cleanup etc ... just haven't gotten around to it yet.

We can consider having different NameACard methods.  (So it's easier to tell the reason you are naming a card).   For now, I would just check in the NameACard method which card is in play, and act appropriately.  We can factor this method out later ...
Logged

SCSN

  • Mountebank
  • *****
  • Offline Offline
  • Posts: 2227
  • Respect: +7140
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #43 on: October 20, 2013, 09:48:09 pm »
0

Quote
HermitMarketSquare begins turn
With hand: Copper,Estate,Hermit,Hermit,Hermit,
  HermitMarketSquare Played Hermit.
    HermitMarketSquare gained Hermit.
  HermitMarketSquare Played Copper.
    +1 Coin = 1 all together.
  HermitMarketSquare Discarded Copper.
  HermitMarketSquare Discarded Hermit.
    HermitMarketSquare trashed Hermit.
    HermitMarketSquare gained Duchy.
      ... and placed card on top of deck

  HermitMarketSquare Discarded Estate.
  HermitMarketSquare Discarded Hermit.
  HermitMarketSquare Discarded Hermit.
  HermitMarketSquare Drew Duchy into hand.
  HermitMarketSquare Drew Estate into hand.
  HermitMarketSquare Drew Hermit into hand.
  HermitMarketSquare Drew Copper into hand.
  HermitMarketSquare Drew Hermit into hand.
  HermitMarketSquare ends turn with deck: Copper(7), Duchy(1), Estate(3), Hermit(6)

Code: [Select]
public override void DoSpecializedDiscardFromPlay(PlayerState currentPlayer, GameState gameState)
        {           
            if (currentPlayer.turnCounters.BuysUsed == 0)
            {               
                currentPlayer.MoveCardBeingDiscardedToTrash(gameState);
                currentPlayer.RequestPlayerGainCardFromSupply(gameState,
                    card => card == Cards.Duchy || card.IsType(Cards.Prize),
                    "Must either gain a duchy or a prize",
                    isOptional:false,
                    defaultLocation:DeckPlacement.TopOfDeck);           
            }           
        }

Oops ;)
Logged

Sparafucile

  • Thief
  • ****
  • Offline Offline
  • Posts: 98
  • Respect: +153
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #44 on: October 21, 2013, 02:48:14 am »
0

Oops indeed :)   I think I snuck A regression on hermit when I was doing tournament.  No idea how I did that.  Kinda wrecked the hermit/market square strategy didn't it ...
Logged

Sparafucile

  • Thief
  • ****
  • Offline Offline
  • Posts: 98
  • Respect: +153
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #45 on: October 23, 2013, 07:40:44 pm »
+1

Now graphing some data!.   The compare players method has the option of creating an HTML report which will show a graphical report of the performance of the 2 strategies compared.

Check out the attachment.

More visualizations to come later!
Logged

Sparafucile

  • Thief
  • ****
  • Offline Offline
  • Posts: 98
  • Respect: +153
    • View Profile
Re: Dominulator: A flexible dominion engine simulator
« Reply #46 on: September 12, 2014, 09:55:13 am »
+1

I have recently gone back to work full time, so I am not spending nearly as much time on the simulator.   I still have time to implement any strategies/functionality and/or integrate any changes people may have.

I haven't pushed any changes in a while because I've been busy refactoring the code for clarity.    I just pushed those changes up to github now.  I have also updated the readme.md.  Please check it out.   There's a lot more functionality now than when I first released the simulator :)  You may find the webapp interesting.

Happy simulating.
Logged
Pages: 1 [2]  All
 

Page created in 1.917 seconds with 21 queries.