         if (card.isTreasure) and (not (card in treasures))
           treasures.push card
             
-      for card in treasures
+      for treasure in treasures
         [hypState, hypMy] = state.hypothetical(my.ai)
-        hypMy.doDiscard(card)
+        hypMy.doDiscard(treasure)
         nowGained = hypMy.ai.pessimisticCardsGained(hypState)
-        state.log("card #{card}, HypGaines: #{nowGained}")
         # test arrays on equality. Better way?
         # changed order in gaining messes this up. Just ignore?
         equal = true

      else if state.phase == 'treasure'
        state.phase = 'buy'
    
    state.log("")
    state.log("HYPOTHETICAL start. Ignore everything...")

    [hypothesis, hypothetically_my] = state.hypothetical(this)
    hypothetically_my.draw = []
    hypothetically_my.discard = []
    
    while hypothesis.phase != 'buy'
      hypothesis.doPlay()

    state.log("HYPOTHTICAL end. ... until here!")
    state.log("")
    
    return hypothesis
  
  pessimisticCardsGained: (state) ->

      [hypState, hypMy] = state.hypothetical(my.ai)
      # technically, we don't want to discard but to put back, but for pessimisticBuy this should not matter
      dis = hypState.requireDiscard(hypMy, 1)
      defaultGained = hypMy.ai.pessimisticCardsGained(hypState)
      
      # determine which treasures are in hand, discard them hypothetically and test if the gains change.  When it doesn't, we can put back this card.
      treasures = []
