The game shapez.io has a huge variety of shapes you can produce, such as:
Each shape has a unique short code, for example the above is CrWbScRu
.
This means, going clockwise from top right, red circle (Cr
), blue wedge (Wb
), cyan star (Sc
), uncolored rectangle (Ru
).
There are four different shapes:
- Rectangle -
R
- Wedge -
W
- Star -
S
- Circle -
C
And eight different colours:
- uncolored -
u
- red -
r
- green -
g
- blue -
b
- yellow -
y
- purple -
p
- cyan -
c
- white -
w
A quadrant is made out of one of each of these - (shape)(color). A quadrant can also be empty with --
. This means there are 33 possible quadrants.
Four quadrants concatenated together make a layer, of which there are \$33^4 - 1 = 1185920\$ possibilities. You can't have an empty layer (--------
). These layers can be stacked on top of one another by joining with :
- the code CyCyCyCy:SrSrSrSr
looks like:
Shapes can be stacked up to 4. This means there are \$\left(33^{4}-1\right)+\left(33^{4}-1\right)^{2}+\left(33^{4}-1\right)^{3}+\left(33^{4}-1\right)^{4} = \$ 1.97 septillion possible shapes total.
Your challenge is to randomly generate one of these.
Your generation does not have to be uniformly random, as long as every possible shape has a nonzero chance of being chosen.
Specs
- Each quadrant is one of
SWCR
followed by one ofugbrycpw
, or--
. - A layer is four quadrants concatenated together.
- A shape is 1-4 layers joined by
:
- You should generate a not-necessarily-uniformly-random shape.
You can view shapes at https://viewer.shapez.io/.
Scoring
This is code-golf, shortest wins!
graphical-output
challenge. \$\endgroup\$