Python and Dominion
Programming and game setup
Dominion is a deck-building card game with 13 expansions.
One of the problems with playing regularly is carting around and keeping track of over 5,000 cards every week. Fortunately, there is a computer language that helps me with the task of setting up the weekly game.
I use Python to select 4 of the 13 expansions.
I then ask it to select a total of 10 kingdom cards from those 4 expansions. If one of the expansions happens to be Alchemy, select 3 cards from the set and the remaining 7 from the rest of the sets.
Then Decide whether or not we are going to play with Platinum and colonies.
Then Decide whether or not we are going to play with shelters.
Then Choose a selection of cards from landmarks, events, ways and projects. Choose between 1 and 3 of these cards. Only 1 of each type.
Finally make a print out of the selected cards for the next 4 weeks.
Here is the code.
import random
display = []ways = ("way of the camel","way of the butterfly","way of the mole","way of the monkey","way of the mouse","way of the worm","way of the chameleon","way of the squirrel","way of the sheep","way of the otter","way of the ox","way of the pig","way of the rat","way of the seal","way of the horse","way of the frog","way of the goat","way of the turtle",)landmarks = ("landmark: palace","landmark: obelisk","landmark: orchard","landmark: museum","landmark: labyrinth","landmark: baths","landmark: tomb","landmark: tower","landmark: colonnade","landmark: fountain","landmark: mountain pass","landmark: keep","landmark: triumphal arch","landmark: aqueduct","landmark: battlefield","landmark: defiled shrine","landmark: arena","landmark: basilica","landmark: wolf den",)events = ("event: conquest","event: annex","event: seaway","event: quest","event: lost arts","event: pilgrimage","event: donate","event: mission","event: training","event: plan","event: advance","event: inheritance","event: expedition","event: trade","event: alms","event: scouting party","event: dominate","event: alliance","event: delay","event: pursue","event: desperation","event: gamble","event: ride","event: populate","event: bargain","event: invest","event: delve","event: wedding","event: ritual","event: Banquet","event: enhance","event: march","event: transport","event: banish","event: toil","event: triumph","event: tax","event: ferry","event: bonfire","event: pathfinding","event: ball","event: stampede","event: enclave","event: demand","event: reap","event: traveling fair","event: raid","event: salt of the earth","project: save",)projects =("project: innovation","project: crop rotation","project: fleet","project: citadel","project: guild hall","project: fair","project: sinister plot","project: capitalism" ,"project: academy","project: city gate","project: exploration","project: sewers","project: pageant","project: road network","project: barracks","project: canal","project: star chart","project: piazza","project: silo","project: cathedral",)alchemy = ("university","university","alchemist","apothecary","apprentice","familiar","golem","herbalist","philosopher's stone","possession","scrying pool","transmute","vineyard","alchemist","apothecary","apprentice","familiar","golem","herbalist","philosopher's stone","possession","scrying pool","transmute","vineyard",)dark_ages =("altar D","armory D","Band of misfits D","bandit camp D","Beggar D","catacombs D","count D","counterfeit D","cultist D","death cart D","forager D","fortress D","graverobber D","hunting grounds D","iron monger D","junk dealer D","marauder D","market square D","mystic D","pillage D","poor house D","procession D","rebuild D","rogue D","sage D","scavenger D","squire D","hermit D","rats D","storeroom D","vagrant D","wandering minstrel D","Knights D","feodum D","urchin D",)renaissance =("acting troupe R","border guard R","cargo ship R","ducat R","experiment R","flag bearer R","hideout R","improve R","inventor R","Lackeys R","mountain village R","old witch R","patron R","priest R","recruiter R","research R","sceptre R","scholar R","sculptor R","seer R","silk merchant R","spices R","swashbuckler R","treasurer R","villain R",)hinterland = ("cache H","border village H","cartographer H","crossroads H", "develop H", "duchess H", "embassy H", "farmland H", "fool's gold H", "haggler H", "highway H", "ill gotten gains H", "inn H", "jack of all trades H", "mandarin H", "margrave H", "noble brigand H", "oasis H", "oracle H", "scheme H", "silk road H", "spice merchant H", "stables H", "tunnel H", "trader H", "nomad camp H",) empire = ("archive E","capital E", "catapult/rocks E", "chariot race E", "charm E", "city quarter E", "crown E", "encampment/plunder E", "enchantress E", "engineer E", "farmer's market E", "forum E", "gladiato/fortune E","groundskeeper E", "legionary E", "overlord E", "patrician/emporium E", "royal blacksmith E", "sacrifice E", "settlers/bustling village E", "temple E", "villa E","wild hunt E", "castles E",) seaside = ("ambassador S","bazzar S", "caravan S", "cutpurse S", "embargo S", "explorer S", "fishing village S", "ghost ship S", "haven S", "island S", "lighthoiuse S", "lookout S", "merchant ship S", "native village S", "navigator s", "outpost S", "pirate ship s", "salvage S", "smugglers S", "tactician S", "Tteasure map S", "treasury S", "warehouse S", "warf S", "sea hag S",)adventures= ("amulet A","artificer A", "bridge troll A", "caravan guard A", "distant lands A", "dungeoun A", "duplicate A", "gear A", "giant A","guide A", "coin of the realm A", "haunted woods A", "hireling A", "lost city A", "magpie A", "page + A", "messenger A", "miser A", "port A", "ranger A", "ratcatcher A", "Raze A ","relic A", "royal carriage A", "storyteller A", "swamp hag A", "Transmogrify A", "Treasure trove A", "wine merchant A", "peasant+ A",)prosperity =( "Bank P", "Bishop P", "city P", "contraband P", "forge P", "goons P", "grand market P", "hoard P", "king's court P", "loan P", "mint P", "monument P", "mountebank P", "peddler P", "Quarry P", "rabble P", "royal seal P", "talismant P", "trade route P", "vault P", "venture P", "watchtower P ","worker's village P","counting house P", "expand P")base_set = ("harbinger BX","merchant BX","sentry BX","diplomat BX","chapel B","council room B","festival B","laboratory B","library B","market B","militia B","mine B","moat B","money lender B","remodel B","smithy B","throne room B","village B","witch B","woodcutter B","workshop B","cellar B","super pawn BX,")guilds_cornucopia = ("vassal CX","bandit CX","patrol CX","fairgrounds C","farming village C","horn of plenty C","forrtune teller C","hamlet C","harvest C","horse trader C","hunting party C","menagerie C","jester C","remake C","tournament C","young witch C","baker G","butcher G","candlestick maker G","doctor G","herald G","journeyman G","masterpiece G","plaza G","southsayer G","stonemason G","taxman G","merchant gui G",)intrigue = ("replace IX","poacher IX","courtier IX","mill IX","secret passage IX","baron I","bridge I","conspiritor I","coppersmith I","ironworks I","masquerade I","mining village I","minion I","pawn I","shanty town I","steward I","swindler I","torturer I","trading post I","upgrade I","wishing well I","great hall I","nobles I","harem I","duke I",)menagerie = ("animal fair M","barge M","black cat M","bounty hunter M","camel train M","cardinal M","cavalry M","coven M","destrier M","displace M","falconer M","fisherman M","gatekeeper M","goatherd M","groom M","hostelry M","hunting lodge M","kiln M","livery M","mastermind M","paddock M","sanctuary M","scrap M","sheepdog M","sleigh M","snowy village M","stockpile M","supplies M","village green M","wayfarer M",)nocturne =("bard N","blesed village N","cemetary/ haunted mirror N","changeling N","cobbler N","conclave N","crypt N","cursed village N","den of sin N","devil's workshop N","druid N","exorcist N","ghost town N","guardian N","idol N","leprecaun N","monastery N","necromancer/zombies N","night watchman N","pixie/goat N","pooka cursed gold N","raider N","secret cave/ magic lamp N","shepherd/pasture N","fool/lucky coin N","skulk N","tormentor N","tragic hero N","tracker/pouch N","werewolf N","vsmpitr/bat N","faithful hound N","sacred grpve N",)for i in range (4):
wselect = random.sample(ways,8)
lselect = random.sample(landmarks,8)
eselect = random.sample(events,8)
pselect = random.sample(projects,8) display1 = ["no way,project,event or landmark"]
display2 = [wselect.pop(),pselect.pop()]
display3 = [eselect.pop()]
display4 = [pselect.pop()]
display5 = [pselect.pop(),eselect.pop()]
display6 = [pselect.pop(),lselect.pop(),eselect.pop()]
display7 = [pselect.pop(),wselect.pop(),]
display8 = [wselect.pop()]
display9 = [wselect.pop(),lselect.pop(),pselect.pop()]
display10 = [wselect.pop(),lselect.pop()]
display11 = [wselect.pop(),lselect.pop(),eselect.pop()]
display12 = [wselect.pop(),eselect.pop(),pselect.pop()]
display13 = [lselect.pop()]
display14 = [lselect.pop(),eselect.pop()]
display15 = [wselect.pop(),eselect.pop()]
display0 = [lselect.pop(),pselect.pop()]num = random.randrange (16) if num == 1: print (display1)
if num == 2: print (display2)
if num == 3: print (display3)
if num == 4: print (display4)
if num == 5: print (display5)
if num == 6: print (display6)
if num == 7: print (display7)
if num == 8: print (display8)
if num == 9: print (display9)
if num == 10: print (display10)
if num == 11: print (display11)
if num == 12: print (display12)
if num == 13: print (display13)
if num == 14: print (display14)
if num == 15: print (display15)
if num == 0: print (display0)print ()
P = "play wih colonies and platinum"
S = "play with shelters"
B = "play with shelters, and colonies and platinum"
N = "no shelters or colonies and platinum"
extras = random.randrange (4)
if extras == 0: print (P)
if extras == 2: print (S)
if extras == 3: print (B)
if extras == 1: print (N)
print ()population = ("x","d","r","h","e","s","a","p","i","m","n","b","c",)
sets = random.sample (population,4)
display = []
if "x" in sets: display.extend (alchemy)
if "d" in sets: display.extend (dark_ages)
if "r" in sets: display.extend (renaissance)
if "h" in sets: display.extend (hinterland)
if "e" in sets: display.extend (empire)
if "s" in sets: display.extend (seaside)
if "a" in sets: display.extend (adventures)
if "p" in sets: display.extend (prosperity)
if "i" in sets: display.extend (intrigue)
if "m" in sets: display.extend (menagerie)
if "n" in sets: display.extend (nocturne)
if "b" in sets: display.extend (base_set)
if "c" in sets: display.extend (guilds_cornucopia)final = random.sample(display,10)print (final)
print ()
print ("###############################################################################")
print ()Jim McAulay🍁 New commandment — hygenesis 20:20
“Thou shalt not covid thy neighbour’s life. Wear thy mask.”
