about | help | code help+videos | done | prefs |
coins
Josh and Daniella are playing a game using a bunch of coins. The players pick several coins out of a pile in turn. Each time a player is allowed to pick 1, 2 or 4 coins, and the player that gets the last coin is the winner. Assume that both players are very smart and he/she will try his/her best to work out a strategy to win the game. For example, if there are 2 coins and Daniella is the first player to pick, she will definitely pick 2 coins and win. Given the number of coins and the order of player you are required to write a program to calculate the winner of the game, and calculate how many different strategies there are for he/she to win the game. coins(2, "josh", "daniella") → "josh 1" coins(3, "daniella", "josh") → "josh 2" coins(10, "daniella", "josh") → "daniella 22" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 400 Post-solution available
Copyright Nick Parlante 2017 - privacy