This challenge is based on a 4×4 grid of dice (16 dice in total). Each game starts by shaking the grid to generate a new grid of 16 values.

All dice are 6-sided dice, generating random values between 1 and 6 when the grid is shaken. The grid can be simplified by showing the actual dice values:

Once the new grid is set, its score can be calculated by identifying specific patterns as follows:

- Start with a score of 0,
- If all four corners are even numbers, add 20 pts to the score,
- If all four corners are odd numbers, add 20 pts to the score,
- If all four dice on a diagonal are even numbers, add 20 pts to the score,
- If all four dice on a diagonal are odd numbers, add 20 pts to the score,
- If all four dice on on any row are even numbers, add 20 pts to the score,
- If all four dice on on any row are odd numbers, add 20 pts to the score,
- If all four dice on on any column are even numbers, add 20 pts to the score,
- If all four dice on on any column are odd numbers, add 20 pts to the score,
- Add to the score the total value (sum) of all 16 dice.

So for example, with the above grid, we can calculate the score of the grid as follows:

#### Python Implementation

To help you with this challenge we have started the code for you by creating 4 functions to:

- Generate/shake the grid of 16 dice.
- Display the 4×4 grid on screen.
- Check if a number is even.
- Check if a number is odd.

We have also implemented the first section of the scoring algorithm, by initialising the grid score to 0 and by checking if all four corners are even. If so the score is increased by 20pts.

Your task is to complete the following code to implement the full scoring algorithm using the **10 rules mentioned above**.

#### Solution...

The solution for this challenge is available to full members!Find out how to become a member:

➤ Members' Area