Problem 3101. Rumis Scorer 3

Rumis is a multiplayer 3D block board game where the goal is to have the most squares visible, when viewed from above, after pieces have been played till there are no moves remaining. The picture below shows a completed 4-player round. There are a variety of board stencils and permissible heights possible in this game.

For this problem, you will be provided a completed board of varying shapes with anywhere from two to six players, inclusive. The players' colors will be selected from the following options, though not necessarily in this order: red (r), orange (o), yellow (y), green (g), blue (b), and purple (p). The character-array board will contain various stencils and maximum heights for each square. As an example, the following board represents an L with maximum heights varying from one to four depending upon location (zeros represent non-playable area):

```1 2 3 4 4 4 4 4
1 2 3 4 4 4 4 4
1 2 3 4 4 4 4 4
1 2 3 4 4 4 4 4
0 0 0 0 3 3 3 3
0 0 0 0 2 2 2 2
0 0 0 0 1 1 1 1
```

For this problem, the board will be completely filled in, and, in line with the game's rules, all players' colors will be represented on the first level. Write a function to count the squares visible when viewed from above to determine who won each round. See the test suite for additional examples (including test case 2, which represents the completed board shown below).

Solution Stats

52.38% Correct | 47.62% Incorrect
Last Solution submitted on Feb 23, 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!