Share your repls and programming experiences

← Back to all posts
The Dice Game
sabhishek78 (2)

Four friends are playing a simple dice game (players are denoted p1, p2, p3, and p4). In each round, all players roll a
// pair of six-sided dice. The player with the lowest total score is removed. If the lowest score is shared by two or more players, the player in that group with the lowest score from their first die is removed. If the lowest score is still shared (i.e. two or more players have the same rolls in the same order), then all players roll again. This process continues until one player remains. Given an array of scores only (given in player order for each round), return the winning player.