Challenge Overview
Problem Statement | |||||||||||||
In a casino, a popular game is played on a device called a slot machine. In the game, 3 wheels have symbols around them. The wheels spin, and each randomly stops on a symbol. When the three symbols on which each wheel lands match, the player wins. It costs one coin for each play of the game. The number of coins the player wins when landing on a winning combination is determined by a payout chart shown below. Although they do not affect the outcome of the game, the player can typically see which symbol is immediately above and below the symbol on which each wheel stopped. The frequency of different symbols appearing on each different wheel, and indeed, on each different machine, may vary. An example of what is visible after playing is shown below: B - C - E -- D - D - D -- F - A - C Each column is the three symbols shown on a given wheel. The middle row is the "pay line", that is to say, the symbols that must match to win a prize. Indeed the result of the spin shown above is a winner. The output of the spin could be described as "BCEDDDFAC", where B-D-F are consecutive symbols on the first wheel, C-D-A are consecutive symbols on the second wheel, and E-D-C are consecutive symbols on the third wheel. Some friends have informed you that at a particular casino, some of the slot machines may be "broken" in a sense that the frequency of symbols on the wheels is such that the player may tend to win more coins than they will lose. You have only a limited amount of time to mess around, as of course you have important meetings to attend, however, you figure it might be worth a look into the situation. Playing a slot machine without paying much attention to the specific outcome (beyond how many coins you may have won) takes a single unit of time, whereas playing in such a way that you make an effort to note down the symbols that show up takes much longer. You will initially be given startingCoins, maxTime, noteTime, and numMachines. The payout table looks the same for all of the slot machines: A A A : 1,000 B B B : 200 C C C : 100 D D D : 50 E E E : 20 F F F : 10 G G G : 5 Your code may call one of two library methods:
In either case, you the number of times you play cannot be more than the number of coins you currently hold, as you cannot depend upon unknown winnings to keep playing. Test case generation is done as follows (all selections are uniformly at random):
The time limit per test case is 30s, and the memory limit is 1GB. Any calls with invalid parameters, any exceptions thrown by competitor code, and so on, will result in failing that test case (and getting no points towards the final score). You may play as few or as many times as you like, so long as you don't run out of coins or time. Your raw score for a test case will be the total number of coins you have at the end of all your playing. Your relative score for a given test case will be YOURS / MAX, where MAX is the highest score anyone achieved for a test case. Your total combined score will be 1,000,000 * SUM(REL_SCORE). You can download the test harness code that is used internally, for reference, to understand test case generation, or for general clarity on how the processing works. [available here] For reference, we are also providing a skeletal solution in Java, C++, C# and Python. [available here] | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
| |||||||||||||
5) | |||||||||||||
| |||||||||||||
6) | |||||||||||||
| |||||||||||||
7) | |||||||||||||
| |||||||||||||
8) | |||||||||||||
| |||||||||||||
9) | |||||||||||||
|
This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2020, TopCoder, Inc. All rights reserved.