Skulls of Sedlec is a card game that revolves around drawing, choosing and positioning cards into a certain shape, in order to maximize their total score.
Scoring, TLDR:
- Each Peasant gives 1 point;
- Each Adjacent Pair of Lovers gives 6 points;
- Each Assassin gives 2 points if adjacent to a Priest
- Each Priest gives 2 points per row (other Priests on same row are ignored);
- Each Hangman gives 1 point, +1 point for all connected Assassins;
- Each Guard gives 1 point, + 1 point for all Royals beneath it;
- Each Royal gives +1 point for all Royals/Villagers beneath it;
Classically, the cards are drawn in turns and placed into a pyramid.
- For >2 players, this pyramid has a base-width of 3 cards, and a height of 3 cards ("3x3");
- For 2 players, this pyramid has a base-width of 4 cards, and a height of 3 cards (flat top) ("4x3");
This small program was made to find the highest possible score for any given pyramid.
For the 3x3 and 4x3 pyramids, this task is trivially solved by brute-forcing. However, as the amount of permutations grows rapidly, a 7x7 pyramid would already require 132,626,429,906,095,529,318,154,240,000,000 iterations to solve.
Instead, this program uses the following pseudo-evolution-algorithm for finding the optimal layout:
- Generate a random layout of cards; regenerate it several thousand times in order to find a good candidate;
- "Evolve" the layout by swapping two cards within it (always find and make the optimal swap); keep evolving for as long as it increases the score;
- "Mutate" the layout by swapping several cards at the same time (including cards previously not in the layout); keep mutating until a layout with higher score is found;
- "Evolve" again (small, optimal swaps);
- "Mutate" again (wider, chaotic swaps);
- Rinse and repeat for as long as the score keeps increasing; if we reach a dead end, but there is a hint that higher scores are possible, regenerate the layout and restart from top;
- If no such hint exists, assume we have found the optimal solution and save it;
This process is ran in parallel on every available thread.
TLDR:
For the standard 3x3 and 4x3 pyramids, the maximum scores are 35 and 69 respectively.
- Don't use Royals;
- Only 1 Peasant/Guard should appear as a filler;
- Only 1 Pair of Lovers might appear;
- Focus on the Assassin+Priest+Hangman combo;
- Don't use Royals;
- Only a few peasants/guards should appear as a filler;
- Only a few pairs of lovers might appear (preferrably at the top of the pyramid);
- Focus on the Assassin+Priest+Hangman combo;
Example:
Guidelines (for all larger pyramids):
- Royals and Guards a very top;
- Use Peasants/Guards as filler at bottom;
- Use Lovers as filler near edges (Lovers are generally outranked by other cards, don't focus much on them);
- Focus on a huge Assassin+Priest+Hangman combo in middle!
- Given 30 cards, this is the biggest pyramid (28 cards) that could be possibly be built.
- Probably the maximum? Not 100% sure. TODO: check again when I'm smarter.