Game simulator (dominion)

12 teams scored 800 points on this task, for a maximum score of 100, an average score of 67 and a median score of 60.

Highlights

  1. Magistri Cumacini, Como is the institute with the most points (100).
  2. Lombardia is the region with the most points (170).

Statement

Giorgio is notoriously fond of board games, and has a particular devotion for the card game Dominion. However, he is recently getting skeptical about the mechanics: too often, the best strategy is just to greedily buy treasure and victory cards. There is only one way to prove his conjecture: writing a game simulator! You are given the description of N different cards, numbered from 0 to N-1. Each card is available in A_i copies, has a price P_i in coins, a revenue R_i in coins, and a value V_i in points. You are also given the description of a starting deck, consisting of M cards C_i among the ones described, indexed from 0 (top deck) to M-1 (bottom deck). The simulated game should consist in T turns as follows: (1) draw the top 5 cards of the deck (maintaining their relative order); (2) sum the revenues of the cards drawn obtaining a number R; (3) buy a copy of the most expensive available card you can afford with R coins, putting it at the bottom of the deck...