Vincenzo De Florio en Engineers and Technicians, Writers, Mathematics Geo-ICT engineer • VITO (Vlaamse Instelling voor Technologisch Onderzoek) 7/6/2018 · 2 min de lectura · +700

The HeartQuake Game (...and Dynamic System!)

The HeartQuake Game (...and Dynamic System!)

(Article originally published on LinkedIn.)


HeartQuake is the English translation for the name of a traditional Italian game of cards, “strappacuore”. The game is played by two opponents with the forty cards of the “Neapolitan” pack of cards. HeartQuake is actually a deterministic procedure: once a shuffling is distributed to the players, the outcome of the game is decided . Moreover, its rules are so simple that it can be played by children. Though the playing of the game is simple, it is quite difficult for an external watcher to foresee the outcome of the game at any moment because of the ease with which the fates of the game rapidly change. This is probably the main reason for the name and the fortune of this game.

The traditional game HeartQuake is based on the 40 playing cards in the Neapolitan pack of cards. Two players are involved, let’s call them Neal and Jack. After a shuffling, 20 cards are given to Neal, 20 to Jack. All cards are unknown to both. A table is available to put cards on. Players are asked to turn the card on top of their pack. Cards belong to two classes: “good” cards (i.e., the four aces, the four twos, an d the four threes), and "bad" cards (i.e., the rest).

As soon as a player, say Neal, turns a good card, say a g, the game enters a second situation in which only Jack reduces his pack: in fact, Jack needs to turn up to g of his cards in search of a good one, if he succeeds the roles swap and it is Neal who needs to exit this dangerous condition. If Jack fails to turn up a good card within g attempts, all cards stacked on the table go on the bottom of Neal's pack. Whoever wins the cards, the first situation starts again. If a player exhausts their pack in search of a good card, the game is over and the opponent wins.

Here you can find a program to simulate HeartQuake.

The code is launched by specifying an initial pack. An example follows:

$ perm 000111111111111111

Results

Results are stored in RESULTS/winnings, which tells for instance

Jack's winnings = 424
Neal's winnings = 389

In RESULTS/not_finished_in_30000 (where 30000 is the value of the THRESHOLD constants) one can see the number of matches that lasted longer than the THRESHOLD; in this case for instance it includes

101111110111101111
111011111011111011
111110111101111110

Each of the above matches enter "loops", which means that they represent cycles of the HeartQuake dynamic system.

My major goal here was in fact to find a way to answer a question about the original game: "does the 40-card Neapolitan pack HeartQuake have loops?" Obviously such a brute force approach did not bear fruit. A clever combinatorial search approach is what I would need here! (Any volunteers out there? ;) )

A little technical detail

Three "main" functions are available: one uses a single game simulation process, one uses fork() to launch several processes, and another one uses the LINDA approach to execute in parallel a number of processes via function eval().

Further information

More information on the game is available at http://www.snotskie.com/the-good-the-bad-and-chaos-in-childrens-card-games/

A paper describing HeartQuake and some of its properties is "The HeartQuake Dynamic System", Complex Systems 9(2), ISSN 0891-2513, available at http://www.complex-systems.com/abstracts/v09_i02_a01/

My post "Permutation numbers with PovRay" discusses the properties of the combinatorial space of (for instance) the HeartQuake games.