How does it work?

The user has the option of changing the amount of dice for each player, attacker and defender. The amount of dice currently chosen by the user is followed by counters that run from 1-3 for the attacker, and 1-2 for the defender.

When the user selects the simulate button, the code will enter a subroutine based on the values of the two counters.

******************************************************************************************************************************

Example: 3v2

All 5 dice rolls are simulated with random number generation, and placed in order from largest to smallest for each side. First, the highest dice roll of each is compared. If the defender's number is equal to or greater than the attacker's, the attacker will lose 1 troop, and vice versa. Next, the same process is used for the next two highest numbers of each side.

The bi-colour RG LED's will flash their neutral orange colour a few times before displaying the troop losses by colour, each LED representing one troop lost. Green for attacker, red for defender.



<--- Shows the results from the serial monitor of simulations of different dice rolling scenarios.

******************************************************************************************************************************

Note: VCC and ground connections to micro missing to reduce clutter. RG LED's were used in my design, but RGB would be fine as well.





You can check out the hardware implementation in this project log.