Deep in the heart of the forest, your team of adventurers stumbles upon a series of peculiar stone coin piles scattered among the trees. As you approach closer, you notice that each pile contains a variable number of stone coins, carefully arranged on stone tablets in a mysterious pattern.
Intrigued by this discovery, you and your fellow adventurers examine the stone coin piles more closely, searching for clues to their significance. Suddenly, Maya, the keen-eyed tracker, exclaims, “These stone coin piles aren’t just random formations—they’re part of a game!”
Your team realizes that the stone coin piles hold the key to a long-forgotten game played by Sasquatch, the legendary guardian of the forest. Determined to unravel the secrets of this ancient game, you decide to decipher the rules and uncover its hidden strategies.
There’s evidence to suspect that the loser of the challenge was called the Nim-compoop, though you’re unsure why. Perhaps the origins of this name hold a clue to the true nature of the game.
Your mission is clear: analyze the stone coin piles, understand the rules of the game, and beat Sasquatch. But, can you decipher the rules of the game and emerge victorious in this ancient challenge?
Good luck, adventurers! The fate of the forest rests in your hands. Uncover the secrets of Nim-compoop and prove yourselves worthy of the guardian’s legacy!
AI Generated Image of stacked stone coins. Image generated by Microsoft Copilot.
AI Generated Image of stacked stones. Image generated by Microsoft Copilot.
You have discovered a series of stone coin piles arranged in the forest. Each stone coin pile contains a variable number of coins. Your task is to determine whether a given scenario is winnable or not, assuming that players play optimally.
Given the initial configuration of stone coin piles, your goal is to analyze the scenario and determine whether you or sasquatch is in a winnable position. Sasquatch is a formidable opponent, and only those who understand the intricacies of the game can hope to emerge victorious.
Rules:
You will be given the state of the game containing
a single array representing the stone coin piles.
the person whose turn it is (yours or sasquatch's).
Each element in the array represents the number of coins in a pile.
Players take turns removing any number of coins from a single pile of their choice.
Players continue taking turns until no coins remain in any pile.
The player who takes the last coin wins the game.
The goal of this program is to calculate, given whose turn it is (yours or Sasquatch’s) and the list of coin piles, whether you or Sasquatch will win (if no mistakes are made).