Algorithm · Square · Easy
Two players, A and B, alternate turns throwing a ball back and forth. On every throw, the thrower has some chance of making a mistake, and that chance depends on which player is throwing (each player has their own mistake probability). As soon as a player makes a mistake, the game ends and the other player is declared the winner. Write code that simulates a single game under these rules and returns which player won. Constraints: There are exactly two players, A and B, who…