Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed some parsing problem with noble brigand

  • Loading branch information...
commit 41277a204c46938d48cbed98b2db946f6d6ee5d7 1 parent 169c95c
@rrenaud rrenaud authored
Showing with 200 additions and 164 deletions.
  1. +141 −141 card_info/card_list.csv
  2. +28 −22 parse_game.py
  3. +31 −1 test_parse_game.py
View
282 card_info/card_list.csv
@@ -1,173 +1,173 @@
-Singular,Plural,Cost,Actions,Cards,Action,Treasure,Victory,Attack,Reaction,Duration,VP,Trash,Coins,Buys
-Adventurer,Adventurers,6,0,2,1,0,0,0,0,0,0,0,0,0
-Alchemist,Alchemists,P3,1,2,1,0,0,0,0,0,0,0,0,0
-Ambassador,Ambassadors,3,0,0,1,0,0,1,0,0,0,0,0,0
-Apothecary,Apothecaries,P2,1,1,1,0,0,0,0,0,0,0,0,0
-Apprentice,Apprentices,5,1,0,1,0,0,0,0,0,0,1,0,0
-"Bag of Gold","Bag of Gold",*0,1,0,1,0,0,0,0,0,0,0,0,0
-Bank,Banks,7,0,0,0,1,0,0,0,0,0,0,?,0
-Baron,Barons,4,0,0,1,0,0,0,0,0,0,0,4,1
-Bazaar,Bazaars,5,2,1,1,0,0,0,0,0,0,0,1,0
-Bishop,Bishops,4,0,0,1,0,0,0,0,0,0,1,1,0
+"Singular","Plural","Cost","Actions","Cards","Action","Treasure","Victory","Attack","Reaction","Duration","VP","Trash","Coins","Buys"
+"Adventurer","Adventurers",6,0,2,1,0,0,0,0,0,0,0,0,0
+"Alchemist","Alchemists","P3",1,2,1,0,0,0,0,0,0,0,0,0
+"Ambassador","Ambassadors",3,0,0,1,0,0,1,0,0,0,0,0,0
+"Apothecary","Apothecaries","P2",1,1,1,0,0,0,0,0,0,0,0,0
+"Apprentice","Apprentices",5,1,0,1,0,0,0,0,0,0,1,0,0
+"Bag of Gold","Bag of Gold","*0",1,0,1,0,0,0,0,0,0,0,0,0
+"Bank","Banks",7,0,0,0,1,0,0,0,0,0,0,"?",0
+"Baron","Barons",4,0,0,1,0,0,0,0,0,0,0,4,1
+"Bazaar","Bazaars",5,2,1,1,0,0,0,0,0,0,0,1,0
+"Bishop","Bishops",4,0,0,1,0,0,0,0,0,0,1,1,0
"Black Market","Black Markets",3,0,0,1,0,0,0,0,0,0,0,2,1
"Border Village","Border Villages",6,2,1,1,0,0,0,0,0,0,0,0,0
-Bridge,Bridges,4,0,0,1,0,0,0,0,0,0,0,1,1
-Bureaucrat,Bureaucrats,4,0,0,1,0,0,1,0,0,0,0,0,0
-Cache,Caches,5,0,0,0,1,0,0,0,0,0,0,3,0
-Caravan,Caravans,4,1,1,1,0,0,0,0,1,0,0,0,0
-Cartographer,Cartographers,5,1,1,1,0,0,0,0,0,0,0,0,0
-Cellar,Cellars,2,1,0,1,0,0,0,0,0,0,0,0,0
-Chancellor,Chancellors,3,0,0,1,0,0,0,0,0,0,0,2,0
-Chapel,Chapels,2,0,0,1,0,0,0,0,0,0,4,0,0
-City,Cities,5,2,1,1,0,0,0,0,0,0,0,1,1
-Colony,Colonies,11,0,0,0,0,1,0,0,0,10,0,0,0
-Conspirator,Conspirators,4,0,0,1,0,0,0,0,0,0,0,2,0
-Contraband,Contrabands,5,0,0,0,1,0,0,0,0,0,0,3,1
-Copper,Coppers,0,0,0,0,1,0,0,0,0,0,0,1,0
-Coppersmith,Coppersmiths,4,0,0,1,0,0,0,0,0,0,0,0,0
+"Bridge","Bridges",4,0,0,1,0,0,0,0,0,0,0,1,1
+"Bureaucrat","Bureaucrats",4,0,0,1,0,0,1,0,0,0,0,0,0
+"Cache","Caches",5,0,0,0,1,0,0,0,0,0,0,3,0
+"Caravan","Caravans",4,1,1,1,0,0,0,0,1,0,0,0,0
+"Cartographer","Cartographers",5,1,1,1,0,0,0,0,0,0,0,0,0
+"Cellar","Cellars",2,1,0,1,0,0,0,0,0,0,0,0,0
+"Chancellor","Chancellors",3,0,0,1,0,0,0,0,0,0,0,2,0
+"Chapel","Chapels",2,0,0,1,0,0,0,0,0,0,4,0,0
+"City","Cities",5,2,1,1,0,0,0,0,0,0,0,1,1
+"Colony","Colonies",11,0,0,0,0,1,0,0,0,10,0,0,0
+"Conspirator","Conspirators",4,0,0,1,0,0,0,0,0,0,0,2,0
+"Contraband","Contrabands",5,0,0,0,1,0,0,0,0,0,0,3,1
+"Copper","Coppers",0,0,0,0,1,0,0,0,0,0,0,1,0
+"Coppersmith","Coppersmiths",4,0,0,1,0,0,0,0,0,0,0,0,0
"Council Room","Council Rooms",5,0,4,1,0,0,0,0,0,0,0,0,1
"Counting House","Counting Houses",5,0,0,1,0,0,0,0,0,0,0,0,0
-Courtyard,Courtyards,2,0,2,1,0,0,0,0,0,0,0,0,0
-Crossroads,Crossroads,2,?,?,1,0,0,0,0,0,0,0,0,0
-Curse,Curses,0,0,0,0,0,0,0,0,0,-1,0,0,0
-Cutpurse,Cutpurses,4,0,0,1,0,0,1,0,0,0,0,2,0
-Develop,Develops,3,0,0,1,0,0,0,0,0,0,0,0,0
-Diadem,Diadems,*0,0,0,0,1,0,0,0,0,0,0,?,0
-Duchy,Duchies,5,0,0,0,0,1,0,0,0,3,0,0,0
-Duke,Dukes,5,0,0,0,0,1,0,0,0,?,0,0,0
-Duchess,Duchesses,2,0,0,1,0,0,0,0,0,0,0,2,0
-Embargo,Embargoes,2,0,0,1,0,0,0,0,0,0,1,2,0
-Embassy,Embassies,5,0,5,1,0,0,0,0,0,0,0,0,0
-Envoy,Envoys,4,0,4,1,0,0,0,0,0,0,0,0,0
-Estate,Estates,2,0,0,0,0,1,0,0,0,1,0,0,0
-Expand,Expands,7,0,0,1,0,0,0,0,0,0,1,0,0
-Explorer,Explorers,5,0,0,1,0,0,0,0,0,0,0,0,0
-Fairgrounds,Fairgrounds,6,0,0,0,0,0,0,0,0,?,0,0,0
-Familiar,Familiars,P3,1,1,1,0,0,1,0,0,0,0,0,0
+"Courtyard","Courtyards",2,0,2,1,0,0,0,0,0,0,0,0,0
+"Crossroads","Crossroads",2,"?","?",1,0,0,0,0,0,0,0,0,0
+"Curse","Curses",0,0,0,0,0,0,0,0,0,-1,0,0,0
+"Cutpurse","Cutpurses",4,0,0,1,0,0,1,0,0,0,0,2,0
+"Develop","Develops",3,0,0,1,0,0,0,0,0,0,0,0,0
+"Diadem","Diadems","*0",0,0,0,1,0,0,0,0,0,0,"?",0
+"Duchy","Duchies",5,0,0,0,0,1,0,0,0,3,0,0,0
+"Duke","Dukes",5,0,0,0,0,1,0,0,0,"?",0,0,0
+"Duchess","Duchesses",2,0,0,1,0,0,0,0,0,0,0,2,0
+"Embargo","Embargoes",2,0,0,1,0,0,0,0,0,0,1,2,0
+"Embassy","Embassies",5,0,5,1,0,0,0,0,0,0,0,0,0
+"Envoy","Envoys",4,0,4,1,0,0,0,0,0,0,0,0,0
+"Estate","Estates",2,0,0,0,0,1,0,0,0,1,0,0,0
+"Expand","Expands",7,0,0,1,0,0,0,0,0,0,1,0,0
+"Explorer","Explorers",5,0,0,1,0,0,0,0,0,0,0,0,0
+"Fairgrounds","Fairgrounds",6,0,0,0,0,0,0,0,0,"?",0,0,0
+"Familiar","Familiars","P3",1,1,1,0,0,1,0,0,0,0,0,0
"Farming Village","Farming Villages",4,2,1,1,0,0,0,0,0,0,0,0,0
-Farmland,Farmlands,6,0,0,0,0,1,0,0,0,2,0,0,0
-Feast,Feasts,4,0,0,1,0,0,0,0,0,0,1,0,0
-Festival,Festivals,5,2,0,1,0,0,0,0,0,0,0,2,1
+"Farmland","Farmlands",6,0,0,0,0,1,0,0,0,2,0,0,0
+"Feast","Feasts",4,0,0,1,0,0,0,0,0,0,1,0,0
+"Festival","Festivals",5,2,0,1,0,0,0,0,0,0,0,2,1
"Fishing Village","Fishing Villages",3,2,0,1,0,0,0,0,1,0,0,1,0
-Followers,Followers,*0,0,2,1,0,0,0,0,0,0,0,0,0
-"Fool's Gold","Fool's Golds",2,0,0,0,1,0,0,1,0,0,0,?,0
-Forge,Forges,7,0,0,1,0,0,0,0,0,0,99,0,0
+"Followers","Followers","*0",0,2,1,0,0,0,0,0,0,0,0,0
+"Fool's Gold","Fool's Golds",2,0,0,0,1,0,0,1,0,0,0,"?",0
+"Forge","Forges",7,0,0,1,0,0,0,0,0,0,99,0,0
"Fortune Teller","Fortune Tellers",3,0,0,1,0,0,0,0,0,0,0,2,0
-Gardens,Gardens,4,0,0,0,0,1,0,0,0,?,0,0,0
+"Gardens","Gardens",4,0,0,0,0,1,0,0,0,"?",0,0,0
"Ghost Ship","Ghost Ships",5,0,2,1,0,0,1,0,0,0,0,0,0
-Gold,Golds,6,0,0,0,1,0,0,0,0,0,0,3,0
-Golem,Golems,P4,0,0,1,0,0,0,0,0,0,0,0,0
-Goons,Goons,6,0,0,1,0,0,1,0,0,0,0,2,1
-Governor,Governors,0,0,0,0,0,0,0,0,0,0,0,0,0
+"Gold","Golds",6,0,0,0,1,0,0,0,0,0,0,3,0
+"Golem","Golems","P4",0,0,1,0,0,0,0,0,0,0,0,0
+"Goons","Goons",6,0,0,1,0,0,1,0,0,0,0,2,1
+"Governor","Governors",0,0,0,0,0,0,0,0,0,0,0,0,0
"Grand Market","Grand Markets",6,1,1,1,0,0,0,0,0,0,0,2,1
"Great Hall","Great Halls",3,1,1,1,0,1,0,0,0,1,0,0,0
-Haggler,Hagglers,5,0,0,1,0,0,0,0,0,0,0,2,0
-Hamlet,Hamlets,2,2,1,1,0,0,0,0,0,0,0,0,1
-Harem,Harems,6,0,0,0,1,1,0,0,0,2,0,2,0
-Harvest,Harvests,5,0,0,1,0,0,0,0,0,0,0,?,0
-Haven,Havens,2,1,1,1,0,0,0,0,1,0,0,0,0
-Herbalist,Herbalists,2,0,0,1,0,0,0,0,0,0,0,1,1
-Highway,Highways,5,1,1,1,0,0,0,0,0,0,0,0,0
-Hoard,Hoards,6,0,0,0,1,0,0,0,0,0,0,2,0
+"Haggler","Hagglers",5,0,0,1,0,0,0,0,0,0,0,2,0
+"Hamlet","Hamlets",2,2,1,1,0,0,0,0,0,0,0,0,1
+"Harem","Harems",6,0,0,0,1,1,0,0,0,2,0,2,0
+"Harvest","Harvests",5,0,0,1,0,0,0,0,0,0,0,"?",0
+"Haven","Havens",2,1,1,1,0,0,0,0,1,0,0,0,0
+"Herbalist","Herbalists",2,0,0,1,0,0,0,0,0,0,0,1,1
+"Highway","Highways",5,1,1,1,0,0,0,0,0,0,0,0,0
+"Hoard","Hoards",6,0,0,0,1,0,0,0,0,0,0,2,0
"Horn of Plenty","Horns of Plenty",5,0,0,0,1,0,0,0,0,0,0,0,0
"Horse Traders","Horse Traders",4,0,-2,1,0,0,0,1,0,0,0,3,1
"Hunting Party","Hunting Parties",5,1,2,1,0,0,0,0,0,0,0,0,0
"Ill-Gotten Gains","Ill-Gotten Gains",5,0,0,0,1,0,0,0,0,0,0,0,0
-Inn,Inns,5,2,2,1,0,0,0,0,0,0,0,0,0
-Ironworks,Ironworks,4,0,0,1,0,0,0,0,0,0,0,1,0
-Island,Islands,4,0,0,1,0,1,0,0,0,2,0,0,0
+"Inn","Inns",5,2,2,1,0,0,0,0,0,0,0,0,0
+"Ironworks","Ironworks",4,0,0,1,0,0,0,0,0,0,0,1,0
+"Island","Islands",4,0,0,1,0,1,0,0,0,2,0,0,0
"Jack of All Trades","Jacks of All Trades",4,0,0,1,0,0,0,0,0,0,0,0,0
-Jester,Jesters,5,0,0,1,0,0,1,0,0,0,0,2,0
+"Jester","Jesters",5,0,0,1,0,0,1,0,0,0,0,2,0
"King's Court","King's Courts",7,0,0,1,0,0,0,0,0,0,0,0,0
-Laboratory,Laboratories,5,1,2,1,0,0,0,0,0,0,0,0,0
-Library,Libraries,5,0,3,1,0,0,0,0,0,0,0,0,0
-Lighthouse,Lighthouses,2,1,0,1,0,0,0,1,1,0,0,1,0
-Loan,Loans,3,0,0,0,1,0,0,0,0,0,1,1,0
-Lookout,Lookouts,3,1,0,1,0,0,0,0,0,0,1,0,0
-Mandarin,Mandarins,5,0,0,1,3,0,0,0,0,0,0,3,0
-Market,Markets,5,1,1,1,0,0,0,0,0,0,0,1,1
-Margrave,Margraves,5,0,3,1,0,0,0,0,0,0,0,0,1
-Masquerade,Masquerades,3,0,2,1,0,0,0,0,0,0,1,0,0
-Menagerie,Menageries,3,1,3,1,0,0,0,0,0,0,0,0,
+"Laboratory","Laboratories",5,1,2,1,0,0,0,0,0,0,0,0,0
+"Library","Libraries",5,0,3,1,0,0,0,0,0,0,0,0,0
+"Lighthouse","Lighthouses",2,1,0,1,0,0,0,1,1,0,0,1,0
+"Loan","Loans",3,0,0,0,1,0,0,0,0,0,1,1,0
+"Lookout","Lookouts",3,1,0,1,0,0,0,0,0,0,1,0,0
+"Mandarin","Mandarins",5,0,0,1,3,0,0,0,0,0,0,3,0
+"Market","Markets",5,1,1,1,0,0,0,0,0,0,0,1,1
+"Margrave","Margraves",5,0,3,1,0,0,0,0,0,0,0,0,1
+"Masquerade","Masquerades",3,0,2,1,0,0,0,0,0,0,1,0,0
+"Menagerie","Menageries",3,1,3,1,0,0,0,0,0,0,0,0,
"Merchant Ship","Merchant Ships",5,0,0,1,0,0,0,0,1,0,0,2,0
-Militia,Militias,4,0,0,1,0,0,1,0,0,0,0,2,0
-Mine,Mines,5,0,0,1,0,0,0,0,0,0,1,0,0
+"Militia","Militias",4,0,0,1,0,0,1,0,0,0,0,2,0
+"Mine","Mines",5,0,0,1,0,0,0,0,0,0,1,0,0
"Mining Village","Mining Villages",4,1,1,1,0,0,0,0,0,0,1,2,0
-Minion,Minions,5,1,0,1,0,0,1,0,0,0,0,2,0
-Mint,Mints,5,0,0,1,0,0,0,0,0,0,?,0,0
-Moat,Moats,2,0,2,1,0,0,0,1,0,0,0,0,0
-Moneylender,Moneylenders,4,0,0,1,0,0,0,0,0,0,1,3,0
-Monument,Monuments,4,0,0,1,0,0,0,0,0,0,0,2,0
-Mountebank,Mountebanks,5,0,0,1,0,0,1,0,0,0,0,2,0
+"Minion","Minions",5,1,0,1,0,0,1,0,0,0,0,2,0
+"Mint","Mints",5,0,0,1,0,0,0,0,0,0,"?",0,0
+"Moat","Moats",2,0,2,1,0,0,0,1,0,0,0,0,0
+"Moneylender","Moneylenders",4,0,0,1,0,0,0,0,0,0,1,3,0
+"Monument","Monuments",4,0,0,1,0,0,0,0,0,0,0,2,0
+"Mountebank","Mountebanks",5,0,0,1,0,0,1,0,0,0,0,2,0
"Native Village","Native Villages",2,2,0,1,0,0,0,0,0,0,0,0,0
-Navigator,Navigators,4,0,0,1,0,0,0,0,0,0,0,2,0
-Nobles,Nobles,6,2,3,1,0,1,0,0,0,2,0,0,0
+"Navigator","Navigators",4,0,0,1,0,0,0,0,0,0,0,2,0
+"Nobles","Nobles",6,2,3,1,0,1,0,0,0,2,0,0,0
"Noble Brigand","Noble Brigands",4,0,3,1,0,1,1,0,0,0,0,1,0
"Nomad Camp","Nomad Camps",4,0,0,1,0,0,0,0,0,0,0,2,1
-Oasis,Oasises,3,1,1,1,0,0,0,0,0,0,0,1,0
-Oracle,Oracles,3,0,2,1,0,0,1,0,0,0,0,0,0
-Outpost,Outposts,5,0,0,1,0,0,0,0,1,0,0,0,0
-Pawn,Pawns,2,1,1,1,0,0,0,0,0,0,0,1,1
+"Oasis","Oases",3,1,1,1,0,0,0,0,0,0,0,1,0
+"Oracle","Oracles",3,0,2,1,0,0,1,0,0,0,0,0,0
+"Outpost","Outposts",5,0,0,1,0,0,0,0,1,0,0,0,0
+"Pawn","Pawns",2,1,1,1,0,0,0,0,0,0,0,1,1
"Pearl Diver","Pearl Divers",2,1,1,1,0,0,0,0,0,0,0,0,0
-Peddler,Peddlers,8,1,1,1,0,0,0,0,0,0,0,1,0
-"Philosopher's Stone","Philosopher's Stones",P3,0,0,0,1,0,0,0,0,0,0,?,0
-"Pirate Ship","Pirate Ships",4,0,0,1,0,0,1,0,0,0,0,?,0
-Platinum,Platinums,9,0,0,0,1,0,0,0,0,0,0,5,0
-Possession,Possessions,P6,0,0,1,0,0,0,0,0,0,0,0,0
-Potion,Potions,4,0,0,0,1,0,0,0,0,0,0,P,0
-Princess,Princess,*0,0,0,1,0,0,0,0,0,0,0,0,1
-Province,Provinces,8,0,0,0,0,1,0,0,0,6,0,0,0
-Quarry,Quarries,4,0,0,0,1,0,0,0,0,0,0,1,0
-Rabble,Rabbles,5,0,3,1,0,0,1,0,0,0,0,0,0
-Remake,Remakes,4,0,0,1,0,0,0,0,0,0,0,0,0
-Remodel,Remodels,4,0,0,1,0,0,0,0,0,0,1,0,0
+"Peddler","Peddlers",8,1,1,1,0,0,0,0,0,0,0,1,0
+"Philosopher's Stone","Philosopher's Stones","P3",0,0,0,1,0,0,0,0,0,0,"?",0
+"Pirate Ship","Pirate Ships",4,0,0,1,0,0,1,0,0,0,0,"?",0
+"Platinum","Platinums",9,0,0,0,1,0,0,0,0,0,0,5,0
+"Possession","Possessions","P6",0,0,1,0,0,0,0,0,0,0,0,0
+"Potion","Potions",4,0,0,0,1,0,0,0,0,0,0,"P",0
+"Princess","Princess","*0",0,0,1,0,0,0,0,0,0,0,0,1
+"Province","Provinces",8,0,0,0,0,1,0,0,0,6,0,0,0
+"Quarry","Quarries",4,0,0,0,1,0,0,0,0,0,0,1,0
+"Rabble","Rabbles",5,0,3,1,0,0,1,0,0,0,0,0,0
+"Remake","Remakes",4,0,0,1,0,0,0,0,0,0,0,0,0
+"Remodel","Remodels",4,0,0,1,0,0,0,0,0,0,1,0,0
"Royal Seal","Royal Seals",5,0,0,0,1,0,0,0,0,0,0,2,0
-Saboteur,Saboteurs,5,0,0,1,0,0,1,0,0,0,0,0,0
-Salvager,Salvagers,4,0,0,1,0,0,0,0,0,0,1,?,1
-Scheme,Schemes,3,1,1,1,0,0,0,0,0,0,0,0,0
-Scout,Scouts,4,1,0,1,0,0,0,0,0,0,0,0,0
-"Scrying Pool","Scrying Pools",P2,1,1,1,0,0,1,0,0,0,0,0,0
+"Saboteur","Saboteurs",5,0,0,1,0,0,1,0,0,0,0,0,0
+"Salvager","Salvagers",4,0,0,1,0,0,0,0,0,0,1,"?",1
+"Scheme","Schemes",3,1,1,1,0,0,0,0,0,0,0,0,0
+"Scout","Scouts",4,1,0,1,0,0,0,0,0,0,0,0,0
+"Scrying Pool","Scrying Pools","P2",1,1,1,0,0,1,0,0,0,0,0,0
"Sea Hag","Sea Hags",4,0,0,1,0,0,1,0,0,0,0,0,0
-"Secret Chamber","Secret Chambers",2,0,0,1,0,0,0,1,0,0,0,?,0
+"Secret Chamber","Secret Chambers",2,0,0,1,0,0,0,1,0,0,0,"?",0
"Shanty Town","Shanty Towns",3,2,2,1,0,0,0,0,0,0,0,0,0
-"Silk Road","Silk Roads",4,0,0,0,0,1,0,0,0,?,0,0,0
-Silver,Silvers,3,0,0,0,1,0,0,0,0,0,0,2,0
-Smithy,Smithies,4,0,3,1,0,0,0,0,0,0,0,0,0
-Smugglers,Smugglers,3,0,0,1,0,0,0,0,0,0,0,0,0
-"Spice Merchant","Spice Merchants",4,?,?,1,0,0,0,0,0,0,0,?,?
-Spy,Spies,4,1,1,1,0,0,1,0,0,0,0,0,0
-Stables,Stables,5,0,0,1,0,0,0,0,0,0,0,0,0
-Stash,Stashes,5,0,0,0,1,0,0,0,0,0,0,2,0
-Steward,Stewards,3,0,2,1,0,0,0,0,0,0,2,2,0
-Swindler,Swindlers,3,0,0,1,0,0,1,0,0,0,0,2,0
-Tactician,Tacticians,5,0,0,1,0,0,0,0,1,0,0,0,0
-Talisman,Talismans,4,0,0,0,1,0,0,0,0,0,0,1,0
-Thief,Thieves,4,0,0,1,0,0,1,0,0,0,0,0,0
+"Silk Road","Silk Roads",4,0,0,0,0,1,0,0,0,"?",0,0,0
+"Silver","Silvers",3,0,0,0,1,0,0,0,0,0,0,2,0
+"Smithy","Smithies",4,0,3,1,0,0,0,0,0,0,0,0,0
+"Smugglers","Smugglers",3,0,0,1,0,0,0,0,0,0,0,0,0
+"Spice Merchant","Spice Merchants",4,"?","?",1,0,0,0,0,0,0,0,"?","?"
+"Spy","Spies",4,1,1,1,0,0,1,0,0,0,0,0,0
+"Stables","Stables",5,0,0,1,0,0,0,0,0,0,0,0,0
+"Stash","Stashes",5,0,0,0,1,0,0,0,0,0,0,2,0
+"Steward","Stewards",3,0,2,1,0,0,0,0,0,0,2,2,0
+"Swindler","Swindlers",3,0,0,1,0,0,1,0,0,0,0,2,0
+"Tactician","Tacticians",5,0,0,1,0,0,0,0,1,0,0,0,0
+"Talisman","Talismans",4,0,0,0,1,0,0,0,0,0,0,1,0
+"Thief","Thieves",4,0,0,1,0,0,1,0,0,0,0,0,0
"Throne Room","Throne Rooms",4,0,0,1,0,0,0,0,0,0,0,0,0
-Torturer,Torturers,5,0,3,1,0,0,1,0,0,0,0,0,0
-Tournament,Tournaments,4,1,1,1,0,0,0,0,0,0,0,1,0
-"Trade Route","Trade Routes",3,0,0,1,0,0,0,0,0,0,1,?,1
-Trader,Traders,4,0,0,1,0,0,0,1,0,0,1,0,0
+"Torturer","Torturers",5,0,3,1,0,0,1,0,0,0,0,0,0
+"Tournament","Tournaments",4,1,1,1,0,0,0,0,0,0,0,1,0
+"Trade Route","Trade Routes",3,0,0,1,0,0,0,0,0,0,1,"?",1
+"Trader","Traders",4,0,0,1,0,0,0,1,0,0,1,0,0
"Trading Post","Trading Posts",5,0,0,1,0,0,0,0,0,0,2,0,0
-Transmute,Transmutes,P,0,0,1,0,0,0,0,0,0,1,0,0
+"Transmute","Transmutes","P",0,0,1,0,0,0,0,0,0,1,0,0
"Treasure Map","Treasure Maps",4,0,0,1,0,0,0,0,0,0,2,0,0
-Treasury,Treasuries,5,1,1,1,0,0,0,0,0,0,0,1,0
-Tribute,Tributes,5,?,?,1,0,0,0,0,0,0,0,?,0
-"Trusty Steed","Trusty Steeds",*0,?,?,1,0,0,0,0,0,0,0,?,0
-Tunnel,Tunnels,3,0,0,0,0,1,0,1,0,2,0,0,0
-University,Universities,P2,2,0,1,0,0,0,0,0,0,0,0,0
-Upgrade,Upgrades,5,1,1,1,0,0,0,0,0,0,1,0,0
-Vault,Vaults,5,0,2,1,0,0,0,0,0,0,0,?,0
-Venture,Ventures,5,0,0,0,1,0,0,0,0,0,0,1,0
-Village,Villages,3,2,1,1,0,0,0,0,0,0,0,0,0
-Vineyard,Vineyards,P,0,0,0,0,1,0,0,0,?,0,0,0
+"Treasury","Treasuries",5,1,1,1,0,0,0,0,0,0,0,1,0
+"Tribute","Tributes",5,"?","?",1,0,0,0,0,0,0,0,"?",0
+"Trusty Steed","Trusty Steeds","*0","?","?",1,0,0,0,0,0,0,0,"?",0
+"Tunnel","Tunnels",3,0,0,0,0,1,0,1,0,2,0,0,0
+"University","Universities","P2",2,0,1,0,0,0,0,0,0,0,0,0
+"Upgrade","Upgrades",5,1,1,1,0,0,0,0,0,0,1,0,0
+"Vault","Vaults",5,0,2,1,0,0,0,0,0,0,0,"?",0
+"Venture","Ventures",5,0,0,0,1,0,0,0,0,0,0,1,0
+"Village","Villages",3,2,1,1,0,0,0,0,0,0,0,0,0
+"Vineyard","Vineyards","P",0,0,0,0,1,0,0,0,"?",0,0,0
"Walled Village","Walled Villages",4,2,1,1,0,0,0,0,0,0,0,0,0
-Warehouse,Warehouses,3,1,0,1,0,0,0,0,0,0,0,0,0
-Watchtower,Watchtowers,3,0,2,1,0,0,0,1,0,0,0,0,0
-Wharf,Wharves,5,0,2,1,0,0,0,0,1,0,0,0,1
+"Warehouse","Warehouses",3,1,0,1,0,0,0,0,0,0,0,0,0
+"Watchtower","Watchtowers",3,0,2,1,0,0,0,1,0,0,0,0,0
+"Wharf","Wharves",5,0,2,1,0,0,0,0,1,0,0,0,1
"Wishing Well","Wishing Wells",3,1,1,1,0,0,0,0,0,0,0,0,0
-Witch,Witches,5,0,2,1,0,0,1,0,0,0,0,0,0
-Woodcutter,Woodcutters,3,0,0,1,0,0,0,0,0,0,0,2,1
+"Witch","Witches",5,0,2,1,0,0,1,0,0,0,0,0,0
+"Woodcutter","Woodcutters",3,0,0,1,0,0,0,0,0,0,0,2,1
"Worker's Village","Worker's Villages",4,2,1,1,0,0,0,0,0,0,0,0,1
-Workshop,Workshops,3,0,0,1,0,0,0,0,0,0,0,0,0
+"Workshop","Workshops",3,0,0,1,0,0,0,0,0,0,0,0,0
"Young Witch","Young Witches",4,0,2,1,0,0,0,0,0,0,0,0,0
View
50 parse_game.py
@@ -42,6 +42,7 @@
KW_BUYS = ' buys '
KW_DISCARDS = ' discards '
KW_GAINING = ' gaining '
+KW_DRAWS = ' draws '
KW_GAINS_A = ' gains a'
KW_GAMES_A = ' games a' # short lived bug in iso, spelled gains as games
KW_GAINS_THE = ' gains the '
@@ -564,7 +565,7 @@ def parse_turn(turn_blob, names_list):
gain_start = line.find(KW_GAINING)
targ_obj['trashes'].extend(capture_cards(line[:gain_start]))
targ_obj['gains'].extend(capture_cards(line[gain_start:]))
- did_trading_post_gain = True
+ did_trading_post_gain = True
else:
targ_obj['trashes'].extend(capture_cards(line))
if KW_WITH_A in line:
@@ -585,9 +586,11 @@ def parse_turn(turn_blob, names_list):
if KW_GAINS_THE in line:
targ_obj['gains'].extend(capture_cards(line))
if has_trashing:
- if KW_REVEALS in lines[line_idx - 1]:
+ if KW_REVEALS in lines[line_idx - 1] and not KW_DRAWS in line:
targ_obj['trashes'].extend(capture_cards(lines[line_idx - 1]))
- if KW_REVEALING in line: # reveals watchtower trashing ...
+ if KW_REVEALING in line or KW_REVEALS in line:
+ # reveals watchtower trashing ...
+ # noble brigand reveals xx, yy and treashes yy
trashed = capture_cards(line[line.find(KW_TRASHING):])
targ_obj['trashes'].extend(trashed)
else:
@@ -633,20 +636,22 @@ def parse_turn(turn_blob, names_list):
turn_money += int(worth_match.group(1))
if u'' in line:
vp_tokens += int(VP_TOKEN_RE.search(line).group('num'))
- if KW_INSTEAD in line and not KW_WISHING in line:
- assert 'buy_or_gain' in targ_obj, \
- "line %s: line\n, targ_obj: %s\n context: %s" % (
- line, str(targ_obj),
- '\n'.join(lines[line_idx - 2: line_idx + 2]))
- targ_list = targ_obj[targ_obj['buy_or_gain']]
- non_silver_ind = len(targ_list) - 1
- while (non_silver_ind >= 0 and
- targ_list[non_silver_ind] == 'Silver'):
- non_silver_ind -= 1
- # This shouldn't work when there is no non-silver, but then
- # non_silver_ind == -1 if there is no non-silver, which magically
- # pops the last item. <3 guido.
- targ_list.pop(non_silver_ind)
+ if KW_INSTEAD in line and not KW_WISHING in line and 'Trader' in line:
+ if 'buy_or_gain' in targ_obj:
+ targ_list = targ_obj[targ_obj['buy_or_gain']]
+ non_silver_ind = len(targ_list) - 1
+ while (non_silver_ind >= 0 and
+ targ_list[non_silver_ind] == 'Silver'):
+ non_silver_ind -= 1
+ # This shouldn't work when there is no non-silver, but then
+ # non_silver_ind == -1 if there is no non-silver,
+ # which magically pops the last item. <3 guido.
+ targ_list.pop(non_silver_ind)
+ else:
+ assert 'Ill-Gotten Gains' in plays, (
+ "line %s: line\n, targ_obj: %s\n context: %s" % (
+ line, str(targ_obj),
+ '\n'.join(lines[line_idx - 2: line_idx + 2])))
now_buys_len = len(targ_obj.get('buys', []))
now_gains_len = len(targ_obj.get('gains', []))
@@ -721,6 +726,9 @@ def outer_parse_game(filename):
return None
except ParseTurnHeaderError, p:
print 'parse turn header error', p, filename
+ except AssertionError, e:
+ print filename
+ raise e
# http://stackoverflow.com/questions/312443/how-do-you-split-a-list-into-evenly-sized-chunks-in-python
def segments(lis, chunk_size):
@@ -756,10 +764,9 @@ def convert_to_json(year_month_day, games_to_parse = None):
else:
print len(games_to_parse), 'games to parse in', year_month_day
- # games_to_parse = games_to_parse[:10]
+ #games_to_parse = games_to_parse[:5000]
pool = multiprocessing.Pool()
parsed_games = pool.map(outer_parse_game, games_to_parse, chunksize=50)
-
#parsed_games = map(outer_parse_game, games_to_parse)
print year_month_day, 'before filtering', len(parsed_games)
parsed_games = [x for x in parsed_games if x]
@@ -808,9 +815,8 @@ def check_game_sanity(game_val, output):
simulating deck interactions saved in game val."""
supply = game_val.get_supply()
- if set(supply).intersection(['Masquerade', 'Black Market']):
- return True
- if set(['Mountebank', 'Trader']).issubset(supply):
+ # ignore known bugs.
+ if set(supply).intersection(['Masquerade', 'Black Market', 'Trader']):
return True
# TODO: add score sanity checking here
View
32 test_parse_game.py
@@ -370,6 +370,30 @@ def test_pirate_ship_turn(self):
self.assertTrue('trashes' not in turn_info)
self.assertEquals(turn_info['ps_tokens'], 1)
+ def test_noble_brigand_trash(self):
+ turn_info = parse_game.parse_turn(
+"""--- player1's turn 10 ---
+ player1 plays a <span class=card-none>Noble Brigand</span>.
+ ... getting +$1.
+ ... player2 draws and reveals a <span class=card-none>Ghost Ship</span> and a <span class=card-treasure>Silver</span>, trashing a <span class=card-treasure>Silver</span>.
+ ... player2 discards a <span class=card-none>Ghost Ship</span>.
+ ... player1 gains the <span class=card-treasure>Silver</span>.""",
+DEF_NAME_LIST)
+ self.assertEquals(turn_info['opp']['p2']['trashes'], ['Silver'])
+
+ def test_noble_brigand_3_p_trash(self):
+ turn_info = parse_game.parse_turn(
+"""--- player1's turn 9 ---
+ player1 plays a <span class=card-none>Noble Brigand</span>.
+ ... getting +$1.
+ ... player2 reveals and discards a <span class=card-treasure>Copper</span> and a <span class=card-none>Warehouse</span>.
+ ... player3 draws and reveals a <span class=card-treasure>Copper</span> and a <span class=card-treasure>Gold</span>, trashing a <span class=card-treasure>Gold</span>.
+ ... player3 discards a <span class=card-treasure>Copper</span>.
+ ... player1 gains the <span class=card-treasure>Gold</span>.""",
+DEF_NAME_LIST)
+ self.assertEquals(turn_info['opp']['p3']['trashes'], ['Gold'])
+
+
def test_bank_turn(self):
turn_info = parse_game.parse_turn(u"""
--- player2's turn 10 ---
@@ -551,7 +575,13 @@ def test_mountebank_traders_turn2(self):
# TODO: fix it if you want an adventure?
#self.assertEquals(turn_info['opp']['p2']['gains'],
# ['Copper', 'Silver'], turn_info['opp']['p2'])
-
+ # similiar bug in
+ # http://councilroom.com/game?game_id=game-20111017-112224-14cd96f7.html&debug=1#Mick_Swagger-show-turn-8
+ # with develop/trader interaction.
+
+ # similiar bug in
+ # councilroom.com/game?game_id=game-20111017-111832-61528d54.html&debug=1#ChickenSedan-show-turn-13
+ # with trader/multiple hoard interaction.
def test_watchtower_buy_curse_turn(self):
turn_info = parse_game.parse_turn(u"""--- player0's turn 11 ---
Please sign in to comment.
Something went wrong with that request. Please try again.