This little device is able to simulate any type of dice rolling instance. 3v2, 3v1, 2v2, 2v1, 1v2, 1v1, it's all adjustable, and quick and easy to use. The two buttons on the left change the number of dice for each respective side, and the button on the right simulates the dice rolls. The LED's on the right show which side lost how many troops.
The idea for this project was heavily inspired by a fellow who designed his own Risk simulator and shared pictures of it on the Arduino subreddit. After seeing this I knew I had to try it myself and put my own twist on it.
DetailsHow 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.
Comments
Please log in or sign up to comment.