Pandaqi / In-the-Same-Boat

Jackbox-style game where you try to sail a ship together - discovering treasures and battling your friends.
2 stars 0 forks source link

Ocean detection algorithm #31

Open Pandaqi opened 5 years ago

Pandaqi commented 5 years ago

The same way I detected (and named) the islands, I would like to detect oceans. (It helps with hints abouts shipwrecks and treasure burying, if I can say: "it sank in the blabla ocean".)

This is the idea.

All water in the game is connected. How do we differentiate bodies of water? Anywhere there's a gap of only 1 or 2 water tiles, we say is an edge between two separate oceans

How do we detect this? I propose the "grow algorithm":

Only one problem: what to do with the tiles we have "grown"?

It's possible for some water tiles to NOT belong to any ocean, but that's actually realistic. These tiles will be very close to land and too far away from other bodies of water, and would, in real life, certainly not be called oceans.

Pandaqi commented 5 years ago

Surprisingly, it works! After fiddling a bit with the settings (the islands grow one tile in all directions, and then another tile horizontally and vertically.)

Two more issues: