Skip to content

thisisrandy/catan-randomizer

Repository files navigation

CI

Catan Randomizer

demo gif

This is a hobby project to produce randomized Catan boards under constraints, e.g. 6 and 8 can't touch, or the pip count for each intersection (the sum of pips on adjacent number chits) can't exceed a certain total. It is deployed here.

While the same idea has been executed many times before, this project supports fairness constraints, Catan expansions, and custom scenarios that aren't seen elsewhere.

Supported Constraints

  • 6 & 8 can't touch
  • 2 & 12 can't touch
  • Same number can't touch
  • Limit on the size of groups of same-type terrain
  • Limit on the total pip count of intersections
  • For scenarios featuring a variable number of islands, a lower limit on the number of islands created. See Seafarers for details

Supported Expansions/Extensions/Scenarios

Catan

Both Catan and Catan: 5-6 Player Extension are supported.

Cities & Knights

Cities & Knights, which is identical to Catan except for the recommended beginner setup, is supported.

Traders & Barbarians

All scenarios described in the manual are supported in every aspect, and combinations of The Fishermen of Catan and other scenarios have been added where appropriate.

On Shuffling Barbarian Attack

Numbers and terrain are shuffled in two separate ("inner" and "outer") groups. It isn't possible to construct the inner group with fewer than 11 pips per intersection, so make sure to adjust your constraints accordingly.

Spinning Oasis

Wherever applicable, the Oasis hex from The Caravans scenario is randomly spun to increase board variability. The official rules specify that it's always in a fixed orientation, so if you prefer that, ignore the orientation that the shuffler produces.

Combinations with The Fishermen of Catan

This section details ways to combine The Fishermen of Catan with each of the other Traders & Barbarians scenarios and other expansions. Note that some combinations differ from the official combinations. In particular, we almost always include the lake, whereas the official combinations frequently exclude it, and we sometimes recommend a different choice for hex/chit removal. You should still read the official rules for each combination, some of which include additional rules. Note also that preparation for the combination with Cities & Knights is just a matter of using the normal The Fishermen of Catan setup, so there is no additional board specified.

With Other Traders & Barbarians Scenarios
  • The Rivers & Lakes of Catan: Combination with The Rivers of Catan. One grain hex and the 2 & 12 chits have been removed to make way for the lake. See below.
  • The Fishy Caravans: Combination with The Caravans. One forest hex has been removed to make way for the lake, and the 2 & 12 chits have been combined onto a single hex.
  • Barbarians Attack the Fish: Combination with Barbarian Attack. One of the interior grain hexes and the interior 3 chit have been removed to make way for the lake.1
  • Traders & Barbarians & Fish: Combination with Traders & Barbarians. Since the 2 & 12 chits are already not present on the board, a 3 chit along with a forest hex are removed to make way for the lake. See below.
  • Traders & Barbarians Ultimate: The "Ultimate" community-created Traders & Barbarians setup that combines all five scenarios.
    • There are 18 total variations on the placement of scenario hexes which the authors suggest you choose by rolling a 3-color die and a number die. The map names are as such suffixed with \((green|purple|orange) [1-6]\). If you don't speak regex, that's e.g. Traders & Barbarians Ultimate (green 1) or ... (orange 5).
    • There are no sea hexes in three of the corners to show where to make space between the borders. However, if you have one hex length pieces from other expansions, it is recommended that you use them so the border is stable.

In both cases, one pasture hex and the 12 chit have been removed to make way for the lake. See below, noting that there is a 2 pirate's lair/goldmine chit that may come into play later in the game. Once this is revealed, players may choose to add the removed 12 chit to the same hex and then play normally, ignoring the recommendations below. Alternately, since gold is distributed on no production rolls in E & P, the recommendations below may be ignored from the outset.

  • Explorers & Pirates & Fish: E & P with fishing ground tiles and a lake.
  • Explorers & Pirates & Cities & Knights & Fish (Oh My!): The same, but configured as recommended for combination with Cities & Knights, i.e. with a grain hex substituted for a forest hex.
  • New World of Fish: New World with fishing ground tiles but no lake.
  • New World of Fish Expanded: New World Expanded with fishing ground tiles and a lake.
  • New World of Fish & Islands: New World Islands with fishing ground tiles and a lake.
  • Everything, Everywhere, All the Fish - Everything, Everywhere, All at Once with the same changes detailed in Combinations with Explorers & Pirates.
  • Everything, Everywhere, All the Fish, Variable - Ditto for Everything, Everywhere, All at Once, Variable.
  • Seafarers & Piratical Fish - Ditto for Seafarers & Pirates.
  • Seafarers & Piratical Fish, Variable - Ditto for Seafarers & Pirates, Variable.
Fishing without 2 & 12 chits

Combining The Fishermen of Catan with other scenarios often necessitates removing the 2 & 12 chits from the board. This section outlines some recommendations for how to handle play when those numbers are rolled or drawn from the Event Card stack.

  • If either of 2 or 12 are rolled or drawn from the Event Card stack, resolve any events, distribute fish to players with cities or settlements adjacent to the lake, and then roll/draw again until a number 3-11 comes up. In the unlikely event that the other of the two 2/12 Event Cards is drawn, resolve it and again distribute fish, but ignore additional 2/12 rolls if playing with dice.2
  • If a 2 or 12 Event Card increases any player's resource card count, their card count remains as it was at the beginning of the turn for the purposes of a 7 roll. For example, if Plentiful Year (2) is drawn and a player's card count increases to 8, they are not penalized if the next card is a 7.
Rules for arranging fishing ground tiles

There are no official rules for the variable placement of fishing ground tiles (the rules for combining with Seafarers simply state "distribute ... according to your personal taste"). Internally, the shuffler is enforcing the following constraints:

  1. All three points of each tile must be pointing at inhabitable intersections.
  2. The hex on which a tile is placed must not contain a port but may be next to one. It may not contain more than one fish tile.
  3. As with ports, no intersection may be adjacent to more than one fish tile. However, intersections adjacent to both a port and fish tile are valid.

Additionally, as noted in the official rules, the lake must always be inland, i.e. not adjacent to any sea hex.

If you are receiving an error related to fishing ground tile placement, please check that your board specification conforms to these rules.

Explorers & Pirates

Shuffling of the starting island for Explorers & Pirates is supported, as is the recommended starting island for combining with Cities & Knights (see the "Possible Combinations" tab on the Explorers & Pirates product page). There's no way to set up the hidden islands face down without involving a third party, and assigned number chits are gameplay-dependent, so no attempt is made to shuffle those.

Seafarers

All Seafarers scenarios are supported, including some custom New World scenarios as well as a partially shuffled version of the The Pirate Islands scenario. Pains have been taken to observe every aspect of variable setup specified in the manual for each scenario, including things like shuffling the main and foreign islands separately, restricting the pip count of certain positions or terrain types, and not shuffling some/all islands and/or ports.

On scenarios with a variable number of islands

Some Seafarers scenarios allow a variable number of islands to be created during terrain shuffling. For these, a Min Island Count constraint is provided from the settings menu to allow for more control over the number of distinct islands generated during the shuffling process. For scenarios which have well-defined "main" and "foreign" islands, the main island is included in this count.

The following scenarios support this constraint:

  • Heading for New Shores
  • Through the Desert
  • New World
  • New World of Fish
  • New World Expanded
  • New World of Fish Expanded
  • New World Islands
  • New World of Fish & Islands
  • Everything, Everywhere, All at Once, Variable
  • Everything, Everywhere, All the Fish, Variable
  • Seafarers & Pirates, Variable
  • Seafarers & Piratical Fish, Variable

Note that the maximum feasible number of islands is different from scenario to scenario. For example, the shuffler can usually find a 7 island board for New World, but since there are only two variable sea hexes in Through the Desert, no more than 4 islands are possible. The shuffler will alert you if the board is over-constrained in this or any other way.

On the New World scenario

New World is the final, fully randomized scenario for Seafarers.

Ports are shuffled such that they are placed with both docks pointing at a terrain hex and no more than one total dock pointing at any given intersection. Within those constraints, they are allowed to appear on any sea hex or border position in this scenario. However, you may feel free to ignore random placement and instead use the instructions from the manual ("Shuffle... with their reverse sides facing up. Starting with the oldest player... each takes a [port] and places it...").

Expanded versions

There are two additional scenarios provided which do not appear in the manual:

  • New World Expanded: Same as New World but using the full frame and all terrain hexes, i.e. adding the 3 deserts, 2 gold fields, and remaining hill and mountain hexes (1 each). Gold fields are restricted to 3 or fewer pips to prevent overly favorable initial settlement opportunities. There is one more number chit than resource-producing hex3, so, following the The Wonders of Catan scenario, the second 12 chit is excluded. It is recommended to increase the victory point goal for this board to 14.
  • New World Islands: Same as New World Expanded, but with distinct and separately-shuffled main and foreign island areas. Following the Through the Desert scenario, gold fields and some of the better number chits are reserved for the foreign island area. You can choose to allow or disallow initial settlements in the foreign island area, but the latter is recommended. Since gold fields can only appear on foreign islands, the pip restriction from New World Expanded is removed.

On the The Pirate Islands scenario

The manual claims, "This scenario is balanced only if the given set-up is maintained. Therefore, it should not be varied, except for the [ports]." These instructions are respected in the The Pirate Islands scenario, but fair variable setups can still be achieved if we just fix the terrain and numbers of the outer ("pirate") islands and the upper ("western") coastline of the main ("eastern") island. A The Pirate Islands (Shuffled) scenario is provided which shuffles the remaining hexes and number chits as well as the ports.

Note that this is a tightly constrained scenario; you may need to relax your constraint settings in order to successfully shuffle it.

On the The Wonders of Catan scenario

According to the manual, for variable setup, "the two terrain hexes adjacent to the deserts shouldn't receive favorable numbers (neither 6 nor 8)." This is observed in the The Wonders of Catan scenario. However, one can't help but wonder why the straight, which one must settle in order to build the Great Bridge, isn't similarly constrained. If this seems unfair to you, a The Wonders of Catan (Straight Constrained) scenario is provided which disallows 6 or 8 appearing on either the desert- or straight-adjacent terrain hexes.

Everything, Everywhere, All at Once

The "Possible Combinations" section of both the Seafarers and Explorers & Pirates pages claim, "In the [Seafarers and Explorers & Pirates] expansions, the ways of using ships and settling new islands are so fundamentally different from each other that it is impossible to combine the expansions. Besides, combining them doesn't make much sense anyway. If you use a settler ship, you reach a new building site for a settlement faster and more cost-effectively than when stringing together various ships."

I claim that they haven't tried hard enough. Enter the Everything, Everywhere, All at Once scenario, which combines Explorers & Pirates, Seafarers, and Cities & Knights (optional).

EEAatO.png

NB: The Orange Sun and Green Moon islands, which, as noted above, must be manually shuffled, are not depicted by the randomizer. Instead, an empty space between the main and Far Islands is displayed. See the rules.

Scenarios

  • Everything, Everywhere, All at Once - Combines Explorers & Pirates, Seafarers, and Cities & Knights. Play to 27 VP.
  • Everything, Everywhere, All at Once, Variable - Same as Everything, Everywhere, All at Once, but with variable Far Island shuffling. Subject to the Min Islands constraint.
  • Seafarers & Pirates - Combines Explorers & Pirates and Seafarers. Play to 22 VP.
  • Seafarers & Pirates, Variable - Same as Seafarers & Pirates, but with variable Far Island shuffling. Subject to the Min Islands constraint.

Rules

For brevity, Explorers & Pirates is abbreviated EP, Seafarers as SF, and Cities & Knights as CK.

If you have not read the rules for the SF/CK combination or the CK/EP combination, you must do so before attempting the Everything, Everywhere, All at Once scenarios (though not the Seafarers & Pirates scenarios). Both rulesets can be found in the "Possible Combinations" section of the CK page. All rules from those combinations apply unless explicitly contradicted below. It is recommended to play both of the two expansion combinations at least once before attempting Everything, Everywhere, All at Once.

  • Setup:
    1. Begin by assembling the final scenario for EP. Remember to substitute an additional fields hex for a forest hex if playing in combination with CK. The randomizer will handle this for you if you select the correct scenario.
    2. Then, using the 2 two hex length and 2 one hex length border pieces from SF, further extend the long side borders by three hex lengths on each side. If you're having trouble visualizing this, check out the example.
    3. Using SF hexes and number chits, create an addition 54 islands (henceforth Far Islands) as specified on the far side of the world.
  • Objective: If playing with just EP and SF, play is to 22 (17 for EP + 5 for SF). If also using CK, add an additional 5 points, for a grand total of 27 VPs.
  • Robber & Pirate:
    • Only the EP pirate is used. VARIATION: Add the robber. When any action that would move the robber or pirate occurs, the initiating player gets to choose which they will move. The robber could even do things like prevent spice (EP) retrieval when occupying a spice village. Make sure to agree to all rules about where the robber can occupy and what it does on each hex type beforehand.
    • Per the EP rules, the pirate can be placed on any sea hex except along the coastline of the EP main island, including in the area around the Far Islands. Also per the EP rules, this does not include border pieces.
    • The pirate's interaction with EP ships and SF shipping routes is the same as specified in the rules for each expansion. In particular:
      • EP: Ships may not move past the pirate without paying tribute unless the pirate is the same color as them. Ships may do battle with the pirate during the player's movement phrase as per the EP rules.
      • SF: The pirate prevents any building or open shipping route movement on any adjacent route. The SF pirate is neutral, so all players are affected regardless of the pirate piece color. VARIATION: The pirate is always friendly towards the player of the same color, even where shipping routes are concerned. Make sure to agree on whether this is the case beforehand.
    • The pirate's interaction with CK knights is the same as specified in the SF/CK combination rules. In particular:
      • Knights may move to or be built on any unoccupied intersection of a trade route, including shipping routes.
      • If active at the beginning of your turn and adjacent to the pirate, a knight may chase the pirate away at the cost of its activation.
  • Settling Foreign Islands:
    • Catan chits (SF) worth one VP each are awarded for each player's first settlement on each of the Far Islands only. Settlements on any part of the Orange Sun or Green Moon islands (EP) are not thusly rewarded.
    • Orange Sun and Green Moon islands (EP) may be settled either with a settler ship (EP) or by building a shipping route (SF) to an intersection and then building a settlement. There are a few compelling reasons to do the latter, despite CATAN GmbH's claim that settler ships are always better:
      1. You are using all of your EP ships for something else.
      2. You want to have a route available to move your CK knights between islands or out into the open ocean to chase the pirate away (knights can exist on any unoccupied trade route intersection but cannot travel on EP ships).
      3. You want to start expanding from a settlement instead of first having to build an EP harbor settlement from which to launch EP ships (SF shipping routes only require an adjacent settlement to start building).
    • The Far Islands may only be settled by building a shipping route (SF) to abut them and then building a settlement. In this way, an extra element of play and strategy is introduced: there is a race to build settlements on the far side of the Orange Sun and Green Moon islands so that a shipping route can be built from them towards one or more of the lucrative Far Islands.
  • Shipping Route (SF)/Ship (EP) Interaction: None. EP ships may sail freely through SF shipping routes and vice-versa.
  • Ports & Trade: The basic trading rate for EP is 3:1, and it remains so here. However, all the 2:1 ports are in play, but only in the seas surrounding the Far Islands. VARIATION: Since it is no small feat to build a settlement on the Far Islands, players may wish to increase the favorability of trades from these ports to 1:1. Make sure to agree beforehand on which rate you wish to use.
  • Gold Mines:
    • Orange Sun and Green Moon islands: Treat these as in EP. A settlement or harbor settlement built adjacent one of these mines (after the resident pirates are driven away, of course) produces 2 gold, and a city produces 4 gold.
    • Far Islands: Treat these as in SF. A settlement produces one resource of the player's choice, and a city produces two. While there's little compelling reason to do so until the endgame (e.g. for victory points that are slightly cheaper than cities, or if cities have run out), players may build harbor settlements on the Far Islands. If they do, harbor settlement production is the same as basic settlements, per usual.
    • VARIATION: Treat all gold mines identically in the manner of your choosing. Remember to agree on this beforehand.
  • Longest Road: Since settling the Far Islands requires long shipping routes, Longest Road is in play for all scenarios.
  • Largest Army: If playing with CK (Everything, Everywhere, All at Once scenarios), Largest Army is irrelevant, since Progress Cards instead of Development Cards are used. However, since the Seafarers & Pirates scenarios exclude CK and hence include Development Cards, Largest Army is in play. VARIATION: Especially when playing without the robber, CK knights can feel under-utilized, since they're rarely in position the chase the pirate away, and displacement tends to happen less often, since EP road networks tend to be smaller. A possible variation to the Everything, Everywhere, All at Once scenarios is to add Largest Army back into play. To determine who to award it to, count only the number of knights each player has, regardless of activation status or strength (basic, strong, or mighty). In this way, a new objective is added: Not only are players vying to have the strongest army to defend against the barbarians, they are also trying to assemble the largest army in terms of number of knights alone.

Example

Here's a played out board constructed using the Everything, Everywhere, All the Fish scenario (Everything, Everywhere, All at Once + The Fishermen of Catan from Traders & Barbarians). Hope you have a large table!

EEAatF.png

Other Features

  • Save/load boards to/from localStorage
  • Generate sharing links for saved boards

Contributing

Pull requests are welcome! In particular, I haven't played every expansion and kind of ran out of steam including the ones I don't even own, so if there's a board configuration you'd like to see made available (customs welcome), please contribute!

Also, my graphic design skills are basic and uncultivated, so if something about the aesthetics of the project is cringe-worthy to your much more refined eye, please feel free to fix it.

The codebase is small and follows the general structure of a create-react-app project, so it should be easy to dive into, but here are some tips:

  • Board definitions are in src/data/expansions.ts, and expansion names are in src/types/boards.ts. Provided that any restrictions on variable setup can be encoded in a CatanBoardTemplate (see boards.ts for details), adding a new board is just a matter of adding a new board definiton and expansion name in these two files.
  • If you're adding a new scenario that features a variable number of islands, enable the Min Island Count constraint by adding your scenario name to islandExpansions at the top of src/components/Randomizer.tsx. Make sure to also mention it in the appropriate README section.
  • All code and docs are formatted using Prettier with default options. Any PRs should be, too.
  • All shuffling logic is thoroughly tested and fully passing. Any fixes or additions should be, too.

Attribution

All images are ripped from the pdf manuals found at catan.com and used without explicit permission. The favicon is a cut-and-paste job of the front cover of the manual. As I do not profit in any way from this project, this usage appears to be in line with the Catan IP guidelines. However, on the off chance that you are associated with CATAN GmbH and feel that this project harms your brand in any way, it will be swiftly and enthusiastically scrubbed from public existence upon request.

Uh, ports? Don't you mean harbors?

You may have noticed that the word "port" is used pervasively to refer to what the Catan manuals call "harbors." I didn't do this on purpose, but once I realized my mistake, I also realized it was actually a correction. Here are some appropriate definitions:

harbor noun A place of safety for ships and other waterborne vessels.

port noun A commercial water facility used for ships and their cargo.

In other words, since harbors are just mooring areas and have nothing to do with goods and trade, what we have in Catan are more aptly called ports.

Footnotes

  1. Barbarian Attack is constructed so that every number chit is represented exactly once along the coastline, so it isn't possible to remove or combine the 2 & 12 chits without altering the scenario mechanics in an undesirable way.

  2. Since there is only one card for each of the 36 possible rolls, it would be unfair to players settled adjacent to the lake to ignore their fish production. However, since fair die rolls are independent and identically distributed events, subsequent 2/12 rolls can be ignored without compromising fairness. Event resolution is perhaps more open to argument. Decide amongst yourselves beforehand if you want to ignore the second/both 2/12 card events and just distribute fish.

  3. For the curious, the extra number chit is used exclusively in the Cloth for Catan scenario, where each cloth island has a number chit on both its east and west sides representing separate villages.

  4. The Variable scenarios may have fewer than 5 Far Islands (6 including the main island), depending on the value of the Min Islands constraint.