After leaving the room with a vault, you've headed toward the dungeon. What you've seen next, turned down your optimism a few notches - the two skeletons laid right behind the entrance to the dungeon. Everything in their appearance indicated that they were the treasure hunters and, judging by the pallor of the bones sticking out of the pants and sleeves, they have laid here for many years. But how did they die?
"Сlick ..." - a barely audible sound of the dungeon door closing. You immediately rushed to it, but it was too late. Of course, it has no keyhole, and no other suggestions that it can be opened, for that matter. You tried to kick it down but it was too strong. Well, if you aren't planning to keep company to those two skeletons and starve to death, you have no choice but to find a way out. Perhaps you can find something useful near the skeletons - they should be examined more closely.
Approaching them, you've heard a voice coming out of nowhere: "... finish ... the game ...". There were only three options: either there was someone alive in the castle, or these were the ghosts that haunted it, or you've started to lose your mind and it was the first hallucination. Nope of those options has been too encouraging, but there were no way back. Finish the game and keep looking for Hypercube.
You most likely know the game where two players are in turn taking from a pile from 1 to 3 stones, and loses the one who took the last stone. We'll slightly generalize this task. Let's assume that both players can take not 1, 2, 3 stones, but k1, k2, …, km of stones. Here we are interested which player wins under the right circumstances (the game played properly and both players use the best strategy).
As the input you will get the number of stones in the pile at the beginning of the game and an amounts of stones you can take from pile at each move. For example - (10, [1, 2, 3]).
If the current amount of the stones in the pile is lower than lowest number in the "moves" list or equal to it - current player takes them all and lose.
Input: An amount of the rocks in the pile and the numbers you can take from it.
Output: Winner's number (1 or 2)
stones(17, [1, 3, 4]) == 2 stones(17, [1, 3, 4, 6, 9]) == 1
How it is used: For the game AI development.
2 players - 1 winner
- No Ads
- No Limits
- More Content
CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.
In order to install CheckiO client you'll need installed Python (version at least 3.8)
Install CheckiO Client first:
pip3 install checkio_client
Configure your tool
checkio --domain=py config --key=
Sync solutions into your local folder
(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)
checkio serv -d
Alternatevly, you can install Chrome extension or FF addon
checkio install-plugin --ff
checkio install-plugin --chromium