6 kyu
Fruit Machine
151 of 3,346adrian.eyre
Description:
Introduction
Slot machine (American English), informally fruit machine (British English), puggy (Scottish English slang), the slots (Canadian and American English), poker machine (or pokies in slang) (Australian English and New Zealand English) or simply slot (American English), is a casino gambling machine with three or more reels which spin when a button is pushed. Slot machines are also known as one-armed bandits because they were originally operated by one lever on the side of the machine as distinct from a button on the front panel, and because of their ability to leave the player in debt and impoverished. Many modern machines are still equipped with a legacy lever in addition to the button. (Source Wikipedia)

Task
You will be given three reels of different images and told at which index the reels stop. From this information your job is to return the score of the resulted reels.
Rules
1. There are always exactly three reels
2. Each reel has 10 different items.
3. The three reel inputs may be different.
4. The spin array represents the index of where the reels finish.
5. The three spin inputs may be different
6. Three of the same is worth more than two of the same
7. Two of the same plus one "Wild" is double the score.
8. No matching items returns 0.
Scoring
Returns
Return an integer of the score.
Example
Initialise
reel1 = ["Wild","Star","Bell","Shell","Seven","Cherry","Bar","King","Queen","Jack"]
reel2 = ["Wild","Star","Bell","Shell","Seven","Cherry","Bar","King","Queen","Jack"]
reel3 = ["Wild","Star","Bell","Shell","Seven","Cherry","Bar","King","Queen","Jack"]
spin = [5,5,5]
result = fruit([reel1,reel2,reel3],spin)
Scoring
reel1[5] == "Cherry"
reel2[5] == "Cherry"
reel3[5] == "Cherry"
Cherry + Cherry + Cherry == 50
Return
result == 50
Good luck and enjoy!
Kata Series
If you enjoyed this, then please try one of my other Katas. Any feedback, translations and grading of beta Katas are greatly appreciated. Thank you.
Arrays
Games
Fundamentals
Similar Kata:
Stats:
Created | May 4, 2017 |
Published | May 4, 2017 |
Warriors Trained | 9488 |
Total Skips | 2105 |
Total Code Submissions | 20846 |
Total Times Completed | 3346 |
Ruby Completions | 151 |
Python Completions | 1024 |
JavaScript Completions | 900 |
C# Completions | 334 |
Haskell Completions | 80 |
Crystal Completions | 11 |
PHP Completions | 157 |
TypeScript Completions | 132 |
C++ Completions | 219 |
C Completions | 96 |
Java Completions | 365 |
Total Stars | 312 |
% of votes with a positive feedback rating | 95% of 672 |
Total "Very Satisfied" Votes | 606 |
Total "Somewhat Satisfied" Votes | 59 |
Total "Not Satisfied" Votes | 7 |
Total Rank Assessments | 8 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |