Permalink
Browse files

don't use the playValue by default for treasure, it slows it down

  • Loading branch information...
1 parent 6090e51 commit 982618ee63e19c5c0760f8a9a536f98665009d97 @rspeer committed Jun 3, 2012
Showing with 9 additions and 6 deletions.
  1. +1 −1 basicAI.coffee
  2. +2 −1 cards.coffee
  3. +5 −3 gameState.coffee
  4. +1 −1 web/play.html
View
@@ -508,7 +508,7 @@ class BasicAI
# `treasurePriority` determines what order to play treasures in.
# Most of the order has no effect on gameplay. The
# important part is that Bank and Horn of Plenty are last.
- old_treasurePriority: (state, my) -> [
+ treasurePriority: (state, my) -> [
"Platinum"
"Diadem"
"Philosopher's Stone"
View
@@ -2217,7 +2217,8 @@ makeCard "Horse Traders", action, {
reactToAttack:
(state, player, attackEvent) ->
- transferCard(c['Horse Traders'], player.hand, player.duration)
+ if c['Horse Traders'] in player.hand
+ transferCard(c['Horse Traders'], player.hand, player.duration)
ai_playValue: (state, my) -> 240
ai_multipliedValue: (state, my) ->
View
@@ -891,6 +891,7 @@ class State
# wants to buy in the current state.
getSingleBuyDecision: () ->
buyable = [null]
+ checkSuicide = (this.depth == 0 and this.gainsToEndGame() <= 2)
for cardname, count of @supply
# Because the supply must reference cards by their names, we use
# `c[cardname]` to get the actual object for the card.
@@ -905,8 +906,8 @@ class State
# Don't allow cards that will lose us the game
#
# Note that this just cares for the buyPhase, gains by other means (Workshop) are not covered
-
- buyable = (card for card in buyable when (not this.buyCausesToLose(@current, this, card)) )
+ if checkSuicide
+ buyable = (card for card in buyable when (not this.buyCausesToLose(@current, this, card)))
# Ask the AI for its choice.
this.log("Coins: #{@current.coins}, Potions: #{@current.potions}, Buys: #{@current.buys}")
@@ -1047,7 +1048,8 @@ class State
# is the appropriate PlayerState object to affect. This must, of course,
# be one of the objects in the `@players` array.
gainCard: (player, card, gainLocation='discard', suppressMessage=false) ->
- delete @cache.gainsToEndGame
+ if this.depth == 0
+ delete @cache.gainsToEndGame
if @supply[card] > 0 or @specialSupply[card] > 0
for i in [player.hand.length-1...-1]
reactCard = player.hand[i]
View
@@ -261,7 +261,7 @@ <h2 class="tagline">A simulator for Dominion strategies.</h2>
multiLog.addPageQuietly('')
msWithControl = new Date() - timeControlStarted
playCount++
- if msWithControl > 250
+ if msWithControl > 1000
tracker.updateScoresOnPage()
grapher.updateGraphs()
window.setZeroTimeout ->

0 comments on commit 982618e

Please sign in to comment.