Oware is a pit and pebble game that consists of two sets of pits or houses filled with pebbles or seeds. During a turn, a player will scoop up all of the seeds from a house under the player’s control and sow the seeds, one at a time, in the next houses around the board.
The Oware transformation of a number is similar. Start with the most significant digit. Zero that position and seed its value—one at a time—in the next most significant digits, wrapping around as necessary. For example, if the number to be transformed is 436, then in the first step, the 4 is zeroed, the second digit (3) is incremented, the third digit (6) is incremented, the first digit (now 0) is incremented, and the second digit (now 4) is incremented to get 157. Continue this process with the (new) next most significant digit until the least significant digit has been transformed.
For example, the number 56 would undergo two steps: 56 to 29 to 74. The number 462 would undergo three steps: 462 to 183 to 426 to 642. Intermediate digits can exceed 9: for example, the four steps involved in transforming 1657 are 1657 to 0757 to 2179 to 431(11) to 7642.
Write a function to compute the Oware transformation of a number.
Solution Stats
Solution Comments
Show comments
Loading...
Problem Recent Solvers4
Suggested Problems
-
Play Oware with the digits of a number
4 Solvers
More from this Author322
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!