Problem 43652. "Bubblegum, Bubblegum, in a dish; How many pieces do you wish?"
The child's game "bubblegum, bubblegum, in a dish; how many pieces do you wish?" is a way of eliminating players until a single player remains. The idea is that all children put their fists into the center of a circle and one of the players (the "leader") says the words "bubblegum, bubblegum, in a dish; how many pieces do you wish?," bumping the fists of the players in order until landing on the final fist on "wish." This player gets to select an arbitrary number that the leader will bump out on the fists of the children. The final person's fist to be bumped is eliminated (each player has two fists, so essentially two tries). Play continues until only one person's fist(s) are left in the circle.
See http://www.gameskidsplay.net/games/circle_games/bubble_gum.htm for another explanation
You are the leader of "bubblegum" (player 1) and need to choose which player wins the game. There are an arbitrary number of players. The numbers selected by the "wishing" player are given in a vector. The players fists are number thus: 1=Player 1, right fist; 2=Player 1, left fist; 3=Player 2, right fist; etc. The initial "bubblegum" chant is 15 fist bumps (the number of beats in the rhyme, NOT the number of syllables).
So, for example, if there are 4 players, the first "wisher" is player 4 (having been bumped on the right fist). If he selects 3, the left fist of the first player is eliminated and the right fist of player 2 is the first bump of the next round.
Graphically: Start:
P1R P1L P2R P2L P3R P3L P4R P4L
P1R P1L P2R P2L P3R P3L P4R-W1 P4L -> wishes "3"; P1L eliminated. Remaining fists:
P1R P2R-W2 P2L P3R P3L P4R P4L -> wishes "5"; P4L eliminated. Remaining fists:
P1R P2R P2L-W3 P3R P3L P4R -> wishes "1"; P3R eliminated. Remaining fists:
P1R P2R P2L-W4 P3L P4R -> wishes "6"; P3L eliminated. Remaining fists:
P1R P2R-W5 P2L P4R -> wishes "3"; P1R eliminated. Remaining fists:
P2R P2L P4R-W6 -> wishes "2"; P2L eliminated. Remaining fists:
P2R P4R-W7 -> wishes "4"; P4R eliminated (eliminates self). Remaining fists:
P2R -> Player 2 is the WINNER!
Return the number of the winning player.
Note: since this is a child's game, a child can inadvertently eliminate himself.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers9
Suggested Problems
-
7650 Solvers
-
336 Solvers
-
Method of Common Differences part-1
55 Solvers
-
589 Solvers
-
212 Solvers
More from this Author11
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!