title | slug | createdAt | coverImage | preview | description | tags | |||
---|---|---|---|---|---|---|---|---|---|
Shuffling algorithm for Labyrinth board game |
7-shuffling-algorithm-for-labyrinth-board-game |
2022-11-13 |
/content-assets/7/cover.png |
false |
Shuffling algorithm for Labyrinth board game.
|
|
One Saturday evening, we were enjoying the weekend and playing Labyrinth the board game. It's a surprisingly fun game even for adults due to its mechanics. There's certainly luck involved but the game decently rewards for route calculation skills.
The most dreading part of the game is the initial shuffling of pieces. Often when my wife seemed happy with the piece positions, I noticed having a few extra strict rules for the initial board. To figure my brain's shuffling rules, I wrote them down:
- Each player should be tightly cornered at the start.
- There should be minimal amount of already connected paths.
That summoned a lot of questions.
What's the maximum length of connected pieces you should aim for? What would be a good shuffling algorithm? Is it even possible to go as low as maximum 2 pieces connected?
That's what we're about to find out!
To answer these questions, we'll obviously need to build the whole game as a React app first. This can be easily done with npm install react-labyrinth-board-game
. Seriously though, we'll skip the boring React details. Here's how the initial version looks like:
<Video width="100%" style={{ borderRadius: '3px' }} preload="auto" autoPlay muted controls="controls" caption="Labyrinth React app with random shuffling">