Permalink
Browse files

Organized goal ideas, added three goals, added my attribution

  • Loading branch information...
1 parent c4f9354 commit b515d2a2958a5999dd798a14a7d22d8974407a46 @DLu DLu committed Sep 29, 2011
View
@@ -0,0 +1,15 @@
+#!/usr/bin/python
+
+import os.path
+from goals import *
+
+def main():
+ for goal_name in sorted(goal_check_funcs):
+ if os.path.exists('static/images/%s.png'%goal_name):
+ found = 'x'
+ else:
+ found = ' '
+ print "%-20s[%s]"%(goal_name, found)
+
+if __name__ == '__main__':
+ main()
View
181 goals.py
@@ -14,7 +14,7 @@
# NegativeSum: Won with a negative score.
# Salted Earth: Had a negative score.
# PileDriver: Owned all copies of a card.
-
+
def CheckMatchBOM(g):
ret = []
cards_per_player = g.cards_accumalated_per_player()
@@ -42,12 +42,12 @@ def CheckMatchBOMMinator(g):
for match_dict in cands:
player = match_dict['player']
if g.get_player_deck(player).WinPoints() > 1.0:
- ret.append({'player': player,
+ ret.append({'player': player,
'reason' : match_dict['reason'] + ' and won'
})
return ret
-#("I thought it was Golf") Winning with a negative score
+#("I thought it was Golf") Winning with a negative score
def CheckMatchGolfer(g):
if g.any_resigned():
return []
@@ -69,7 +69,7 @@ def CheckMatchPileDriver(g):
for card, quant in card_dict.iteritems():
if quant == card_info.num_copies_per_game(card, game_size):
ret.append(
- {'player': player,
+ {'player': player,
'reason': 'Bought all %d copies of %s' % (
quant, card)}
)
@@ -103,7 +103,7 @@ def CheckMatchMrGreenGenes(g):
if len(victory_quants) >= 6:
ret.append({
'player': player,
- 'reason': 'Bought %d differently named Victory cards' %
+ 'reason': 'Bought %d differently named Victory cards' %
len(victory_quants)}
)
return ret
@@ -113,7 +113,7 @@ def CheckScore(g, low, high=None):
for player in g.get_player_decks():
score = player.points
if score >= low and (high is None or score < high):
- ret.append({'player': player.name(),
+ ret.append({'player': player.name(),
'reason': "Scored more than %d points" % low})
return ret
@@ -122,7 +122,7 @@ def CheckScore(g, low, high=None):
# Royal Heir: Scored 80 points.
# Monarch: Scored 90 points.
# Imperial: Scored 100 points.
-# Archon: Scored 110 points.
+# Archon: Scored 110 points.
def CheckMatchPeer(g):
return CheckScore(g, 60, 70)
@@ -146,42 +146,125 @@ def GroupFuncs(funcs, group_name):
for idx, func in enumerate(funcs):
func.group = group_name
func.priority = idx
-
-GroupFuncs([CheckMatchPeer, CheckMatchRegent, CheckMatchRoyalHeir,
+
+GroupFuncs([CheckMatchPeer, CheckMatchRegent, CheckMatchRoyalHeir,
CheckMatchMonarch, CheckMatchImperial, CheckMatchArchon], 'vp')
-#("Buzzer Beater") Winning by exactly one point
+# == How the game ends
+#("Buzzer Beater") Winning by exactly one point
def CheckMatchBuzzerBeater(g):
scores = {}
for player in g.get_player_decks():
score = player.points
scores[player.name()] = score
s_scores = sorted(scores.iteritems(), key=operator.itemgetter(1), reverse=True)
if len(s_scores)>1 and s_scores[0][1] == s_scores[1][1] + 1:
- return [{'player': s_scores[0][0],
+ return [{'player': s_scores[0][0],
'reason': "Won by exactly one point"}]
-# Bought more than 10 green cards in a turn
-# won without ever buying money
-# played 20 actions in a turn
-# Protego: Reacted to all attacks against you (and at least 5).
-#("Penny Pincher") Winning by buying out the Coppers
-#("Estate Sale") Winning by buying out the Estates
-#("This card sucks?") Winning with an Opening Chancellor
-#("Bully") Play an attack every turn after the fourth.
-#("The Biggest Loser") Losing with over 60 points.
-#("Puppet Master") Play more than 4 Possession in one turn.
-#("Dominator") Have at least one of each type of available victory card (and at least 1 chip, if available).
-#buying at least one of every kingdom card in a game
-# gifted a Province or Colony to an opponent (through Masquerade or Ambassador),
-# Researcher: Acquire 7 Alchemists or Laboratories.
-# Evil Overlord: Acquire 7 or more Minions.
-# Badges? We Don't Need No Stinking Badges: Win a game while holding no VP Tokens and your opponent holds 25 or more.
-# It's Good to be the King: Acquire 4 Throne Rooms or King's Courts.
-# 99 Problems: Acquire the majority of Harems.
-# Crucio: Use the Torturer three times in a single turn.
+# Anticlimactic - shared a victory with two or more opponents
+def CheckAnticlimactic(g):
+ if len(g.get_player_decks()) < 3:
+ return []
+
+ shared_score = None
+ for player in g.get_player_decks():
+ score = player.points
+ if shared_score == None:
+ shared_score = score
+ elif shared_score != score:
+ return []
+ ret = []
+ for player in g.get_player_decks():
+ ret.append( {'player': player.name(), 'reason': 'Shared a victory with two or more opponents'} )
+ return ret
+
+
+#("The Biggest Loser") Losing with over 60 points.
+# Surprise Attack - end the game on supply piles when those three piles had totaled at least 5 cards at the start of your turn.
+# Badges? We Don't Need No Stinking Badges: Win a game while holding no VP Tokens and your opponent holds 25 or more.
+
+# == How the game ends
+#("Penny Pincher") Winning by buying out the Coppers
+#("Estate Sale") Winning by buying out the Estates
+
+# == Value of victory points
+
+# Carny - at least 30 VP from Fairgrounds
+# Original suggestion: Blue ribbon - ended game with a Fairgrounds worth 8 VP
+def CheckMatchCarny(g):
+ ret = []
+ for player, deck in g.cards_accumalated_per_player().iteritems():
+ if 'Fairgrounds' not in deck:
+ continue
+ fg_pts = 2 * len(deck.keys()) / 5 * deck['Fairgrounds']
+ if fg_pts >= 30:
+ ret.append( {'player': player, 'reason': '%d VP from Fairgrounds'%fg_pts} )
+ return ret
+
+
+# Gardener - at least 20 VP from Gardens
+# Original suggestion: ended game with a Gardens worth 6 VP
+def CheckMatchGardener(g):
+ ret = []
+ for player, deck in g.cards_accumalated_per_player().iteritems():
+ if 'Gardens' not in deck:
+ continue
+ deck_size = sum(deck.itervalues())
+ g_pts = deck_size / 10 * deck['Gardens']
+ if g_pts >= 20:
+ ret.append( {'player': player, 'reason': '%d VP from Gardens'%g_pts} )
+
+ return ret
+
+# Duke of Earl
+# Original suggestion Duchebag :-) - at least 42 points from dukes and duchies alone
+def CheckMatchDukeOfEarl(g):
+ ret = []
+ for player, deck in g.cards_accumalated_per_player().iteritems():
+ if 'Duke' not in deck:
+ continue
+ duke_pts = deck['Duke'] * deck.get('Duchy', 0)
+ duchy_pts = deck['Duchy'] * 5
+ d_pts = duke_pts + duchy_pts
+ if d_pts >= 42:
+ ret.append( {'player': player, 'reason': '%d VP from Dukes and Duchies'%d_pts} )
+ return ret
+
+# == Use of one card in a turn
+#("Puppet Master") Play more than 4 Possession in one turn.
+# Crucio: Use the Torturer three times in a single turn.
# Imperio: Use Possession three times in a single turn.
+
+# == Every Turn
+# Protego: Reacted to all attacks against you (and at least 5).
+#("Bully") Play an attack every turn after the fourth.
+# Empty Throne Room
+# Empty Kings Court
+
+
+# == Number of Cards acquired
+# King of the Joust - acquire all five prizes
+# Researcher: Acquire 7 Alchemists or Laboratories.
+# Evil Overlord: Acquire 7 or more Minions.
+# It's Good to be the King: Acquire 4 Throne Rooms or King's Courts.
+# 99 Problems: Acquire the majority of Harems.
# Game of Settlers Anyone?: Acquire 7 of a single Village-type card.
+# won without ever buying money
+#("Dominator") Have at least one of each type of available victory card (and at least 1 chip, if available).
+# buying at least one of every kingdom card in a game
+
+# == Specific Uses
+# Used Possession+Masquerade to send yourself a Province or Colony
+# gifted a Province or Colony to an opponent (through Masquerade or Ambassador),
+# De-model - remodeled a card into a card that costs less
+# Banker - played a Bank worth $10
+# Look Out! - revealed three 6+-cost cards with Lookout
+# Goon Squad - acquired 42 VP tokens from Goons in a single turn
+# played 20 actions in a turn
+
+#("This card sucks?") Winning with an Opening Chancellor
+
def CheckPointsPerTurn(g, low, high=None):
ret = []
@@ -198,16 +281,16 @@ def CheckPointsPerTurn(g, low, high=None):
gain = scores[turn_no+1][i] - scores[turn_no][i]
if gain >= low and (high is None or gain < high):
ret.append({
- 'player': p,
- 'reason': "Scored %d or more points in one turn" %
+ 'player': p,
+ 'reason': "Scored %d or more points in one turn" %
low})
return ret
-#Slam: 20 or more points in one turn.
-#Crash: 30 or more points in one turn.
-#Charge: 40 or more points in one turn.
-#KO: 50 or more points in one turn.
-#Blitz: 60 or more points in one turn.
+#Slam: 20 or more points in one turn.
+#Crash: 30 or more points in one turn.
+#Charge: 40 or more points in one turn.
+#KO: 50 or more points in one turn.
+#Blitz: 60 or more points in one turn.
#Onslaught: 70 or more points in one turn.
def CheckMatchSlam(g):
return CheckPointsPerTurn(g, 20, 30)
@@ -235,30 +318,30 @@ def CheckMatchMegaTurn(g):
ret = []
scores = []
if 'Colony' in g.get_supply():
- biggest_victory = 'Colony'
- else:
+ biggest_victory = 'Colony'
+ else:
biggest_victory = 'Province'
- victory_copies = card_info.num_copies_per_game(biggest_victory,
+ victory_copies = card_info.num_copies_per_game(biggest_victory,
len(g.get_player_decks()))
for turn in g.get_turns():
new_cards = turn.buys + turn.gains
if len(new_cards) < victory_copies:
continue
if new_cards.count(biggest_victory) == victory_copies:
ret.append(
- {'player': turn.player.name(),
- 'reason': "Obtained all of the %s cards in one turn" %
+ {'player': turn.player.name(),
+ 'reason': "Obtained all of the %s cards in one turn" %
biggest_victory})
return ret
-#("Oscar The Grouch") Trash more than 7 cards in one turn
+#("Oscar The Grouch") Trash more than 7 cards in one turn
def CheckMatchOscarTheGrouch(g):
ret = []
for turn in g.get_turns():
trashes = len(turn.turn_dict.get('trashes',[]))
if trashes >= 7:
- ret.append({'player': turn.player.name(),
+ ret.append({'player': turn.player.name(),
'reason': "Trashed %d cards in one turn" % trashes})
return ret
@@ -288,7 +371,7 @@ def GroupAndPriority(goal_match_doc):
return func.group, func.priority
goal_matches.sort(key = GroupAndPriority)
-
+
for goal_match_doc in goal_matches:
for attainer in goal_match_doc['attainers']:
if attainer['player'] == norm_target_player:
@@ -310,7 +393,7 @@ def GroupAndPriority(goal_match_doc):
img_loc = 'static/images/%s.png' % goal_name
ret += (
'<li style="float: left;">'
- '%s<img src="%s" title="%s%s"></a><br>' %
+ '%s<img src="%s" title="%s%s"></a><br>' %
(game.Game.get_councilroom_link_from_id(game_id),
img_loc, goal_name, reason))
if freq > 1:
@@ -320,9 +403,9 @@ def GroupAndPriority(goal_match_doc):
return ret
def print_totals(checker_output, total):
- for goal_name, output in sorted(checker_output.iteritems(),
+ for goal_name, output in sorted(checker_output.iteritems(),
key=lambda t: len(t[1]), reverse=True):
- print "%-15s %8d %5.2f" % (goal_name, len(output),
+ print "%-15s %8d %5.2f" % (goal_name, len(output),
len(output) / float(total))
@@ -343,7 +426,7 @@ def main():
output_collection.remove()
output_collection.ensure_index('attainers.player')
output_collection.ensure_index('goal')
-
+
print 'starting with id', scanner.get_max_game_id(), 'and num games', \
scanner.get_num_games()
for g in utils.progress_meter(scanner.scan(games_collection, {})):
View
@@ -23,7 +23,8 @@ <h1>CouncilRoom.com</h1>
<a href="http://boardgamegeek.com/user/rrenaud">
(BGG profile)</a> and <a href="player?player=Larry">Larry</a>, and
<a href="player?player=rspeer">rspeer</a>
- <a href="mailto:rob.speer@gmail.com">(rob.speer@gmail.com)</a>.
+ <a href="mailto:rob.speer@gmail.com">(rob.speer@gmail.com)</a>, and
+ <a href="player?player=hawaiian+shirts">hawaiian shirts</a> <a href="http://probablydavid.com">(David Lu!!)</a>.
Graphic design by NemoRathwald/Matt Arnold (mat<span class="z">_REMOVE_</span>t.ma<span class="z">_THIS_</span>tta<span class="z">_FOR_</span>rn@<span class="z">_SPAM_</span>gma<span class="z">_PROTECTION,_</span>il.c<span class="z">_HUMANS!_</span>om) <a href="http://boardgamegeek.com/user/Matt_Arnold">(BGG profile)</a>.
</p>
<div class="cardborder yellow">
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b515d2a

Please sign in to comment.