[Question]
  [
There's a minigame in Super Mario 3D World known as the *Lucky House*. It consists of a slot machine with 4 blocks.
[![Lucky House](https://i.stack.imgur.com/dKGVQ.jpg)](https://i.stack.imgur.com/dKGVQ.jpg)
Each block may be one of 5 different icons (Flower, Leaf, Bell, Cherry or Boomerang) and the goal of the player is to get as many identical icons as possible ([see a video](https://youtu.be/5YZ52pWn9Ms?t=8)).
The player is rewarded with coins, which in turn may be converted into extra lives. **Your task is to compute the number of extra lives won.**
Depending on the number of icons that match, the amount of coins rewarded are as follows:
* No matches - 10 coins
* One pair - 100 coins
* Two pairs - 200 coins
* Three-of-a-kind - 300 coins
* Four-of-a-kind - 777 coins
**You win one extra life (1UP) every 100 coins**. Therefore, you're guaranteed to win exactly 1UP with *one pair*, 2UP with *two pairs* and 3UP with *3-of-a-kind*. However, the number of lives won with *no matches* or *4-of-a-kind* depends on your initial coin stock.
*Source: [Super Mario Wiki](https://www.mariowiki.com/Lucky_House)*
## Input
You're given the initial coin stock \$0 \le c < 100\$ and a list of four values \$[v\_1,v\_2,v\_3,v\_4]\$ representing the final icons on the slot machine.
## Output
The number of extra lives won: \$0\$, \$1\$, \$2\$, \$3\$, \$7\$ or \$8\$.
## Rules
* You may take the icons in any reasonable format: e.g. as a list, as a string or as 4 distinct parameters.
* Each icon may be represented by either a **single-digit integer** or a **single character**. Please specify the set of icons used in your answer. (But you don't have to explain how they're mapped to Flower, Leaf, Bell, etc., because it doesn't matter at all.)
* You are not allowed to remap the output values.
* This is üé∞[code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'")üé∞.
## Test cases
In the following examples, we use a list of integers in \$[1..5]\$ to represent the icons.
```
coins  icons      output   explanation
-------------------------------------------------------------------------
  0    [1,4,2,5]    0      no matches  ->  0 +  10 =  10 coins -> nothing
 95    [3,1,2,4]    1      no matches  -> 95 +  10 = 105 coins -> 1UP
 25    [2,3,4,3]    1      one pair    -> 25 + 100 = 125 coins -> 1UP
 25    [4,5,5,4]    2      two pairs   -> 25 + 200 = 225 coins -> 2UP
  0    [2,5,2,2]    3      3-of-a-kind ->  0 + 300 = 300 coins -> 3UP
 22    [1,1,1,1]    7      4-of-a-kind -> 22 + 777 = 799 coins -> 7UP
 23    [3,3,3,3]    8      4-of-a-kind -> 23 + 777 = 800 coins -> 8UP
 99    [3,3,3,3]    8      4-of-a-kind -> 99 + 777 = 876 coins -> 8UP
```
  
[Answer]
# x86-16 Assembly, ~~56~~ ~~41~~ 39 bytes
**Binary:**
```
00000000: b103 33ed ac8b fe51 f2ae 7503 45eb f983  ..3....Q..u.E...
00000010: fd03 7504 80c2 4d43 03dd 59e2 e592 7502  ..u...MC..Y...u.
00000020: 040a 3c64 7201 43                        ..<dr.C
```
**Unassembled:**
```
B1 03           MOV  CL, 3              ; set up loop counter for 3 digits
            DIGIT_LOOP: 
33 ED           XOR  BP, BP             ; clear digit matches counter in BP
AC              LODSB                   ; load next digit char into AL
8B FE           MOV  DI, SI             ; start searching at next char
51              PUSH CX                 ; save outer digit loop counter 
            MATCH_LOOP: 
F2/ AE          REPNZ SCASB             ; search until digit in AL is found 
75 03           JNZ  CHECK_FOUR         ; is end of search?
45              INC  BP                 ; if not, a match was found, increment count
EB F9           JMP  MATCH_LOOP         ; continue looping 
            CHECK_FOUR: 
83 FD 03        CMP  BP, 3              ; is four of a kind? 
75 04           JNE  SCORE_DIGIT        ; if not, add number of matches to 1UP's
80 C2 4D        ADD  DL, 77             ; add 77 to coin count 
43              INC  BX                 ; +1 1UP extra for four-of-a-kind
            SCORE_DIGIT:
03 DD           ADD  BX, BP             ; Add number of matches to total, set ZF if 0
59              POP  CX                 ; restore outer digit loop position
E2 E5           LOOP DIGIT_LOOP         ; keep looping
92              XCHG DX, AX             ; coin count to AX for shorter compare
75 02           JNZ  FINAL_SCORE        ; if 1UPs > 0, no consolation prize
04 0A           ADD  AL, 10             ; award 10 coins
            FINAL_SCORE:
3C 64           CMP  AL, 100            ; is coin score over 100?
72 01           JB   DONE               ; if not, no extra 1UP
43              INC  BX                 ; otherwise, increment 1UP
            DONE:
```
Input starting coin count in `DX`, `SI` pointing to start of "icon" bytes (which can be `'1'`-`'5'`, or any byte value). Output the number of 1UP's in `BX`.
**Explanation:**
The input of four bytes is iterated and compared to the remaining bytes to the right, counting the number of matches. The scores for each type of match are awarded and add up to the total. Since a four-of-a-kind is also three-of-a-kind and also a one-pair, the value of each score type can be decomposed as follows:
* 3 matches = 4 1UP's + 77 coins
* 2 matches = 2 1UP's
* 1 match = 1 1UP
***Examples:***
`[2, 2, 2, 2]` (four-of-a-kind) = 7 1UP's + 77 coins
```
2 [2, 2, 2] = 3 matches = 4 1UP's + 77 coins
   2 [2, 2] = 2 matches = 2 1UP's
      2 [2] = 1 match   = 1 1UP
```
`[2, 5, 2, 2]` (three-of-a-kind) = 3 1UP's
```
2 [5, 2, 2] = 2 matches = 2 1UP's
   5 [2, 2] = 0 matches
      2 [2] = 1 match   = 1 1UP
```
`[4, 5, 5, 4]` (two pair) = 2 1UP's
```
4 [5, 5, 4] = 1 match   = 1 1UP
   5 [5, 4] = 1 match   = 1 1UP
      5 [4] = 0 matches
```
`[2, 3, 4, 3]` (one pair) = 1 1UP
```
2 [3, 4, 3] = 0 matches
   3 [4, 3] = 1 match   = 1 1UP
      4 [3] = 0 matches
```
If number of earned 1UP's is 0 at the end, 10 coins are awarded. If total coins are greater than 100, an additional 1UP is awarded.
Here is a test program for PC DOS that includes extra routines to handle the integer value I/O:
[![enter image description here](https://i.stack.imgur.com/0XZfJ.png)](https://i.stack.imgur.com/0XZfJ.png)
Download and test [LUCKY.COM](https://stage.stonedrop.com/ppcg/LUCKY.COM) for DOS.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), ~~23 22 20~~ 19 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
-1 thanks to [Erik the Outgolfer](https://codegolf.stackexchange.com/users/41024/erik-the-outgolfer) (use `¬≥` in place of `»∑2`) also used in newer version twice  
-1 thanks to [Grimy](https://codegolf.stackexchange.com/users/6484/grimy) (subtract one before summing instead of subtracting four afterwards)
Maybe beatable?
```
ƒã‚±Æ`‚ÄôS·πö·∏åH√ó¬≥¬´777¬ª‚Åµ+:¬≥
```
A dyadic Link accepting a list and an integer which yields an integer.
**[Try it online!](https://tio.run/##y0rNyan8//9I96ON6xKC400e7pz1cEePx@HphzYfWm1ubn5o96PGrdpWhzb/Pzb58PJjk/9Hm@iAYSyXpSUA "Jelly ‚Äì Try It Online")** Or see a [test-suite](https://tio.run/##y0rNyan8//9I96ON6xKC400e7pz1cEePx@HphzYfWm1ubn5o96PGrdpWhzb/Pzb56J7Dy/UfNa05OunhzhlAGoi8gTjyf3R0tKGOgomOgpGOgmmsjoIBEEdHG@soGIKFTIBcS1OwGJBnDFZpDOQaQcSAPFMwMkGIGYEFgKQR3DhDsHEgBFJmBLMCikBixphilpaxsQA "Jelly ‚Äì Try It Online").
### How?
```
ƒã‚±Æ`‚ÄôS·πö·∏åH√ó¬≥¬´777¬ª‚Åµ+:¬≥ - Link: list a, integer n   e.g. [x,x,x,x], 22
 ‚±Æ`                 - map across a with:
ƒã                   -   count occurrences in a       [4,4,4,4]
   ‚Äô                - decrement                      [3,3,3,3]
    S               - sum (call this s)              12
     ·πö              - reverse (implicit toDigits)    [2,1]
      ·∏å             - un-decimal                     21
       H            - halve                          10.5
         ¬≥          - 100                           100
        √ó           - multiply                     1050
           777      - 777                           777
          ¬´         - minimum                       777
               ‚Åµ    - 10                             10
              ¬ª     - maximum                       777  (handles 0 -> 10)
                +   - add (n)                       799
                  ¬≥ - 100                           100
                 :  - integer division                7
```
How the hand evaluation works for each type of hand:
```
           Hand:    no-pair     pair        2-pair      trips       4-of-a-kind
(sorted) counts:    [1,1,1,1]   [1,1,2,2]   [2,2,2,2]   [1,3,3,3]   [4,4,4,4]
      decrement:    [0,0,0,0]   [0,0,1,1]   [1,1,1,1]   [0,2,2,2]   [3,3,3,3]
            sum:    0           2           4           6           12
       reversed:    [0]         [2]         [4]         [6]         [2,1]
     un-decimal:    0           2           4           6           21
         halved:    0           1           2           3           10.5
      times 100:    0           100         200         300         1050
    min(x, 777):    0           100         200         300         777
     max(x, 10):    10          100         200         300         777
```
---
Alternative 20: `ƒ†·∫à·ªã‚Äú¬°ƒ±Kƒñ‚ÄòS√ó4+E{¬ª‚Åµ+:¬≥`
[Answer]
# [Zsh](https://www.zsh.org/), ~~117 ...~~ 60 bytes
***-13** by using a different criterion for differentiation, **-9** by combining cases, **-28** by changing the `case` statement to a nested arithmetic ternary, **-4** thanks to @JonathanAllan, **-1** by optimizing the ternaries, **-2** because I accidentally used `echo` when adding Jonathan's optimization.*
Takes coin count on stdin, and block inputs as arguments. Arguments can be numbers, characters, or even strings: `./foo.zsh flower leaf flower boomerang`
```
read c
for i;for j;((a+=i<j))
<<<$[!a?7+(c>22):a-6?6-a:c>89]
```
Try it online:
~~[117](https://tio.run/##PY5BasMwEEX3c4oP1cJKCVQjmdaRE3qPkoWQVWwwNlRJCg06uzt2S/gIvXn6A/rJ/fLdD2PCVwodxmFKHt1M6RZG5HTBfg@1WorzMOWjMpT74fNC1bItRArHSt2rSb8XTTHkBHV/EnHVoZQHHsyBS8EwkWPdtq36iKe35uy93a2j8Z43zwJmBev97q/4@lzFk7yeKeUQFw2xUNtvqJuntLwABg6MmpoaVgaGI67lsuLtig61xJF0pSeHiVmaW4gt/kNN88Bf "Zsh ‚Äì Try It Online")
[104](https://tio.run/##PY5Ra8MwDITf9SsO6od4pdDISddMadn/GH0wjkoMIYG6bLDS35452RiHuNPxCfSd@vmrj4Pipr7DEEcVdBPppx@Q9I7dDmZpKUxxTCdTUurj9U7FvB4Euk43qBSF357MY2Me728bo8@ntRR8UhiPONLetm1rPl63RTgz24vIYWmcyHFxFilXpBR5@UXD@dhcSJMPs0VuYNYHqJtGnfdAiQqMmpoaLi@MirjO5nLvllihzqoos5nLw8ScyVXEDn@ipvmPPw "Zsh ‚Äì Try It Online")
[95](https://tio.run/##PY1Ri8JADITf8ysG3IfuSTmbtmptlfsfhw/LNqULpQVXFE787b1Yj2MImfmYkJ/Yz/c@DIKLuBZDGKVGO5Hc3IAoV6QpzIuSn8IYjyaj2IfuSsm8HHjqpgukThK3PprHyjy@Disjz6e15F0UGIcw0sY2TWO@d@vEn5jtua4zfiN/2lcaP95pm7pPPpNE52cLRTDLX2qnUeYNkKEAo6SqRK6BURCXunLl@csWKFUFaVd7OkzM2lxEnONPVFX/9hc "Zsh ‚Äì Try It Online")
[67](https://tio.run/##PYzdCoJAEIXv5ykOuBe7iJSjVv708x7RxaIbCqKQUpD47DZJxGGYM4fvzHuol1fdtA4PZyu0TedyVD25p20xuBFBAPVNqeybbjiqkIa6uY@kl7VQ0r1/wOVaW/@oJk9Nl8xTbp6NoaIo1NWetQ1CPu8Cu@GsPB1Sk@19XZ6YzW0xEAhq/U1V37llC4SIwUgoTRDJwYiJE1mR5NHXxkhEMQkrnAwTs5CriCP8RGn6tx8 "Zsh ‚Äì Try It Online")
[63](https://tio.run/##PYzNCoNADITveYo5eNhFhBp/Wv8fpPSwrFtcERdUWujL21VKGZJMhi/5rMP@HuxksBjVY7KzqdA7Mi81YTUbogjBkZJ2dl6bIKZ1sM@NxH4eaHq6BbY6@lgJocLG1qOUZPTgENxVJ1SUd3mkSt3eClleQ6FbZvnYJeq6RnD@pd7NZr8AMVIwMioyJH5hpMSZH4nPk8OmyLxS8qznfDExe/IUcYKfqCj@9gs "Zsh ‚Äì Try It Online")
[62](https://tio.run/##PYzbCoNADETf8xVT8EERocZL6/1DSh@WdWVXxAWVFvrzdpVShiST4SSfVe9vbSaFRYkek5lVhd6SeokJq9oQRfCOlKQ189p4Ma3aDBv5@3kgabALTHX0sfJ9ETamHoOAlNQW3uMiulvoy5Y5KEWUd3kkStnei@ceoK5reOdb6u2s9isQIwUjoyJD4hZGSpy5kbg8OWyKzCklxzrOFROzI08RJ/iJiuJvvw "Zsh ‚Äì Try It Online")~~
**[60](https://tio.run/##PYzbCoNADETf8xVT8EGRhRovrfcPKX1YdMUVUVBpoT9vo5QyJJkMJ/ms/f7u7WiwGN1itJPJ0c5kXnrEajYoBedIqZnttJZOQGtvu43c/TxoqJsX2PzoQ@662i9tMXgeFUXhPC66vvluUzF7mVZJnSidNdU9fe4eBIBzPqV2nsx@BQJEYMSUxghlYUTEsYxQ8vCwEWJRRMIKJ8XELOQp4hA/UZr@7Rc "Zsh ‚Äì Try It Online")**
Here's the magic from the 67 byte answer:
```
read coins
for block                  # for each element
  (( a+=${#${@:#$block}} ))
#          ${@:#$block}      remove all elements which don't match
#       ${#            }     count the remaining elements
# (( a+=                 ))  add that number to the total
<<<$[a?(a-12?6-a/2:coins>89):7+(coins>22)]
#    a?                     :7+(coins>22)  4*0 (all elements match all elements)
#      (a-12?     :coins>89)               4*3 (all elements match exactly one)
#      (a-12?6-a/2         )               3*1 + 1*3 ->  6, 6 -  6/2 -> 3
#                                          2*2 + 2*2 ->  8, 6 -  8/2 -> 2
#                                          2*3 + 2*2 -> 10, 6 - 10/2 -> 1
```
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), ~~123~~ ~~106~~ 90 bytes
```
a=>b=>(a+("ƒ¨Ãâ√àd\n"[(b=b.GroupBy(x=>x,(o,p)=>p.Count())).Count()*(b.Max()==3?0:1)]))/100
```
A port of my python answer, which is derived from @Dat's answer.
[Try it online!](https://tio.run/##bY7PSsNAEMbvfYrS04wdY7KbHGrdFSwqhfbsofawG1MI2E3IH0j7BPouvoU99p3SSVGQRoYZvpkfM9/E5XVcpu1T7eK71FV0FvNHV2@Twtj3pBtq6oreq9YobZUGM4bR4ev4@f3x9upGK7DKes9FVucPO2iUbggyylHp3JtltasAEX/VFVhvaRpApeS9fxvgGvEm8P12OmCT4Qa6aig3hdmWQ25Wa8uX9mAQLE4HL0VaJYvUJbABnwIKSVCEF2ASkWQmKLwkIuKp5C35Lwm7e9izYQvOHhCCTc7RI5J@ovfa5A9pTw "C# (Visual C# Interactive Compiler) ‚Äì Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), 63 bytes
```
lambda x,l:int([3,1,7.77,2,.1][sum(map(l.count,l))%14%5]+x/1e2)
```
[Try it online!](https://tio.run/##jZLdasQgEIWv41PMzUKkQzZqQpqFXPUxrBdpm9CFJIbowu7Tp675wUKglUHOjN8ZFR0f9lsPfG6r97mr@4@vGu7YXa6DjaVAhkVSFMgxYUqaWx/39Rh3yae@DRY7Sk8sO@Xq5X5mDaezbYx9q01joAJJwI1l9ipFkAwhQ@AIuVK4L6VerYXAUebOIhCYt2Shha2WKMD5E3eg8JuIf@EOzH386s4P8HRpnvuz8JAWR835cts1Qrw4wsVy0zVC/PUAL8s/caIIafUE25PAddi1uZBIuydq460iU@UCIcyZoiSaHLYXmesZjdPza2i6qWlXuqr2ZP4B "Python 2 ‚Äì Try It Online")
I had the same idea as [GammaFunction](https://codegolf.stackexchange.com/a/190180/20260) to use `sum(map(l.count,l))` as a "fingerprint". But, instead of using an arithmetic formula on the result, I use a lookup table, first squishing the value to 0 through 4 using a mod chain `%14%5`. Dividing all the point values by 100 saved a few bytes. 
[Answer]
# [Python 3](https://docs.python.org/3/), 68 bytes
```
def f(c,a):x=sum(map(a.count,a))//2;return[c//90,x-2,7+(c>22)][x//3]
```
[Try it online!](https://tio.run/##jZHbasQgEIav41PMpVJbTxu22SW96WOIFyFN6F5sDMZA9ulTaw61EGhlkH/G7x8d7B/@03Zqnj@aFlpc04pcpnIY7/he9bh6qe3Y@VAkjMmra/zoOl0zVnA6PUt6fsL1m5TE6IkxZWbfDP69GpoBStAIwlr2qDgFLSicKEgKuTF0P@JRrYXEUeTBoiiIaDmlFrFasgSX33gAVbxE/QsPYB7jV3d5gPOleR7fIlNaHTWXy7RrpPj5CFfLpGuk@OsBXhR/4sgg1FoH25fArdv1cEGZDV/U4q2iuQlBIc2FIShzAduLIvTMenfrPLZkU25Xtix/EjJ/AQ "Python 3 ‚Äì Try It Online")
A Python port of my C port of my Bash port of my Zsh answer, re-golfed with help from the "Tips for golfing in Python" page.
Last port, I swear... I'm running out of languages I'm comfortable golfing in. I was curious how this strategy compared to the other Python answers. Again, there's probably some way to beat this.
This one turned out surprisingly good, so I added a table below summarizing what's happening so others can port or improve this.
```
Type          Example  map(a.count,a)  sum(__)   x=__//2  x//3   array lookup
----------------------------------------------------------------------------
none         [1,2,3,4]    [1,1,1,1]        4       2       0      c//90
pair         [1,1,2,3]    [2,2,1,1]        6       3       1      x-2 -> 1
two pair     [1,3,1,3]    [2,2,2,2]        8       4       1      x-2 -> 2
3-of-a-kind  [1,3,1,1]    [3,1,3,3]       10       5       1      x-2 -> 3
4-of-a-kind  [3,3,3,3]    [4,4,4,4]       16       8       2      7+(c>22)
```
## [Python 3.8 (pre-release)](https://docs.python.org/3.8/), 63 bytes
Praise the `:=` walrus!
```
lambda c,a:[2+c//90,x:=sum(map(a.count,a))//2,9+(c>22)][x//3]-2
```
[Try it online!](https://tio.run/##jZHdasQgEIWv41PMpbLTmuiGbgL2po9hvbDphl1oYkiysH361JqfWgi0MsiZ8Tujg93neHGtPHX9VKvX6cM2b@8WKrSlFoeK8yLFe6mGW0Mb21H7WLlbO6JljHOBxYFWz0Iwo@@cS/MgpvE8jC92OA@gQBPwa96DShF0hnBEEAi5MbgdpUEthchR5N4iEbJgOcaWbLEkES6@cQ/KcIn8F@7BPMSv7mIHT@fmeXiLiGm511zM0y4R4097uJwnXSLGTzt4UfyJE0NI7XpYvwSu7aaHkiTOf1FN14pOjQ@EOM8MI0nvsa2Y@Z5J11/bkTq2qn5TTqmfhE1f "Python 3.8 (pre-release) ‚Äì Try It Online")
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~48~~ 44 bytes
```
{*/100+((0,0,1,3,7.77)[.Bag{*}].sum||.1)+|0}
```
[Try it online!](https://tio.run/##jdDPa8IwFAfw8/pXvNO0Ns3yozXKUNhgtx12cZfSQ9FWyzSRxiGi/u1dkrpawcH6IKSPx4eX7zav1sN6c4DHAib1cfBECQn6fYIIoogjgYXwE/yaLY@Dc4r19@Z0wtQPTuRcF6qCdSlzPZ3ivaoWGo7eg84OUPRxQlP89vny7psrSX0EPeghwAlLn71zDUDAfAlFEWIoTu2P6wBIBZtsN1/lGiCc2nYAQAlM3DlXpdS2L9VuVcqlB@PYSdxsy1DkJHpXMoO/EiXxVaKzDw9YozDz4gjxrqJkDtusrOzdTDOrmIiswv5QIhSbanZhjbLbK6fojsKcwroKs8olG5OLeRFzCm8UHqoizMKvUi7abLhT7Nkq3O3CLgm7copolOhWMYMBCCGMIsbjqyKcwi/punLK6L7CW2XU3WVkFcP@TzGDrSKGN8oP "Perl 6 ‚Äì Try It Online")
Curried function `f(icons)(coins)`.
[Answer]
# [Python 2](https://docs.python.org/2/), 96 91 89 bytes
*-2 bytes thanks to @Kevin Cruijssen*
```
lambda x,a,b,c,d:(x+(100*sum((a==b,a==c,a==d,b==c,b==d,c==d))or 10)+177*(a==b==c==d))/100
```
[Try it online!](https://tio.run/##Xc3LCsIwEAXQvV/RZdJeME9Khf6Jm6SlKNgHtUL9@jgJiqEMcxlOwszy3m7zpMLQXsPDjb53xQ4Hjw79he0Vk0KUz9fImGtbD4ouRg8fJx@njoLzeS2k4JWs6zJ9pefkZ1oQlvU@bWxgAhIGCpbz088aC02sYI6oD6gsgaYF@ogmbs1QxBvUuSlFV1LlqPGt/Hjzx/AB "Python 2 ‚Äì Try It Online")
[Answer]
# PHP, ~~153~~ 127 bytes
*@640KB* made some really clever changes to shorten it further:
```
function($c,$s){for(;++$x<6;$n+=$m>3?777:($m>2?300:($m>1)*100))for($m=!$y=-1;++$y<5;$m+=$s[$y]==$x);return($c+($n?:10))/100|0;}
```
[Try it online!](https://tio.run/##dY5da4MwFIbv/RVZOTAz05kPM2lj5g/pelHEYmlNxA@odPvtLgYGg2W8uTjhyXPydk23FGXXdFGUpugyPg/IXk8zGi2ahhqdjDvWzK2dBnSeTDVerIngppefSwwVgQE/zraPVZLAvXhTYBIN7bso8zzfx27ipaDUTwy/MEoxXp9Dq59g1lu2enMhFbTOGw4wH7WGO1Z9PU79@kMSgyn3zHmpsz@p@lpUFCFUV41FcIspQQdGMsKJPOLXzYfZqF90Jx0WhDmcBTBfMSfC@eI/nBHpErKpl6XbzUMy9818Qlj4Zj6h4ru/ePkG "PHP ‚Äì Try It Online")
[Answer]
# [Python 3](https://docs.python.org/3/), ~~126~~ ~~111~~ ~~108~~ 103 bytes
```
def f(c,a):x=sorted([a.count(i)for i in set(a)]);return([300,777,200,100,10][len(x)*(x[-1]!=3)]+c)//100
```
[Try it online!](https://tio.run/##jZLbboQgEIav5Smmd9DSLoc11m286mMQLoyLqUkjG2QT@/QW8VCamLRm1GH4/gHyc/vyH7aX03Q1LbS4oTW5jNVgnTdXrOqXxt57jzvSWgcddD0MxuOaaPLmjL@7HivJGC2Kgorw5/HV6tP0eCSPeFTPXD9UkuinhpxOYXryZvDv9WAGqEAhCM/yjRmjoDiFMwVBIdea7lMsZmshUZR5kEgKPErOqYSvkizBxYwHUMZF5L/wAOYxfnUXBzhbmudxLyKl5VFzsZx2jRQvjnC5nHSNFH89wMvyTxxphGZfN0tme3d7LiizwaIWbxUVfGWaQjrmmqDMBWwv8tAzu7kuXBpLtsztma2qnwGZvgE "Python 3 ‚Äì Try It Online")
[Answer]
# [Python 3.8 (pre-release)](https://docs.python.org/3.8/), 78 bytes
```
lambda c,a:(ord("ƒ¨Ãâ√àd\n"[len(x:=[*map(a.count,{*a})])*(max(x)!=3)])+c)//100
```
Dat's answer, but golfed more.
[Try it online!](https://tio.run/##jZHPTsQgEMbP5SlwT1CJC2Ubt004@RjdHrDbxk220NCa1Bjv@i6@hR59p4r0z2LSRMmEfDP8voEJzVP3oBXfN2aoxGE4y/r@KGFBZIq0OaLN5/vX28fr8aA22blUqE9FFtayQfKm0I@qI8@hfME5DlEte9TjK8Ftdl3g7ZZROnRl293JtmyhgBmAdo27U5TAjBG4IzAiMM5zshxRp6aC50hia@EEMmfZ@RY2WQIPj35wC3J3Cf8XbsHYxa/u0QpOx@axe0vk03yteTROO4WP367hfJx0Ch/fr@BJ8icOcgAqbeD8JfCkFt2mIND2iyo0VzKa2yDQz1mOQWAsthSZ7Rk05qQ6pPGszKK0EJcED98 "Python 3.8 (pre-release) ‚Äì Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/) `-pF`, 46 bytes
```
map$q+=$$_++,@F;$_=0|<>/100+($q>5?7.77:$q||.1)
```
[Try it online!](https://tio.run/##K0gtyjH9/z83sUClUNtWRSVeW1vHwc1aJd7WoMbGTt/QwEBbQ6XQztTeXM/c3EqlsKZGz1Dz//8kIOCytPiXX1CSmZ9X/F@3wA0A "Perl 5 ‚Äì Try It Online")
First of input is the spin result, using any 5 unique ASCII letters, except `q` (I suggest `abcde`). The second line of input is the current coin count.
## How?
```
-F     # CLI option splits the input into individual characters in @F
map
   $q+=   # $q holds the result of the calculation here
          # possible values are 0,1,2,3,6
   $$_    # This interprets $_ as a variable reference, thus if $_ is 'a', this variable is $a
   ++     # increment after adding it to $q
,@F;      # iterate over the elements of @F
$_=0|     # force the result to be an integer
   <>/100 # divide the current coin count by 100
   +($q>5?7.77  # if $q is over 5, then there must have been 4 of a kind
   :$q||.1)     # otherwise, use $q, unless it is 0, then use .1
-p        # CLI option implicitly outputs $_
```
All of the numbers involved are divided by 100, so the program is counting the number of lives (including partial ones) currently earned. The trick to this solution is in the `map`. If the possible entries are `abcde`, then each of `$a`, `$b`, `$c`, `$d`, and `$e` hold the count of the number of times this character had previously been seen. That gets added to a running total (`$q`) each time a character is seen. The running total is bumped up if there is a four of a kind (effectively a 177 coin bonus).
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 64 bytes
```
c=>a=>[,7.77,a.sort()[1]-a[2]?2:3,1,.1][new Set(a).size]+c*.01|0
```
[Try it online!](https://tio.run/##XY9NboMwEEb3nGIWXUA7QWBANImcHqJLy1Isx7RUFEfg/qgpZ6djB6QqmoVHz988e97Upxr10J7dprcnMzd81vyg@EFgndY1qnS0g4sTkcuNEkw@sV2BOaa5FL35gmfjYpWkY/tj5IO@T7P8N5s748CZ0Y3AQUQAAiBDEDmWyLCSCJnEgLcVYa9jWBLOF8w8ZlhQvrjFJVZUPs0WHNzkJQkhKNY0C0@GIlyvuAhPhiL8uP5ke4MjuY@ixg4Q@22Etm0/IrTa@sN8n4125iTBNtdNE7iQx0eVdh@qo82bOAwlcRhK9nTvG9uZtLMv8XGV7ODusvYTLvMeXjtC78rp1/8x4JwvwelI5mn@Aw "JavaScript (Node.js) ‚Äì Try It Online")
I figured there had to be at least one JavaScript answer to an Arnauld challenge!
The concept here is mainly to use the number of distinct elements as a lookup key.
* 1 unique => 4 of a kind
* 2 unique => 2 pair or 3 of a kind
* 3 unique => 1 pair
* 4 unique => no matches
In order to distinguish between 2 pair and 3 of a kind, the input array is sorted and the middle 2 elements are compared.
[Answer]
# [PHP](https://php.net/), ~~89~~ 84 bytes
```
foreach(count_chars($argv[2])as$a)$b+=[2=>1,3,7.77][$a];echo$argv[1]/100+($b?:.1)|0;
```
[Try it online!](https://tio.run/##jdLBjtowEADQe75iFOVAhFliBxqyKaA9tGqllYq06imNkEkNSQs2is320Pbb07GXBDggFUtWYnvejIccq2P7fnmsjp4XGKGNhjnkHuQQEYCckglhZFoQiAAnGI8BQCo4cFNWQgOMFoBbQwAaYaCdS1VLbdelMlUtd9ZKpwTymFC0JsjQu1Y67S0aTS8W/bqyDrMOIzFWFd86Sgo48rrBR3ueWYdGzmF3nAmZ4rD1sItjfinn6CuHOYddO@zNcT3C/uC9GBLxxYlHajvio5@1/N73KHaOnXsnPtfDiO21G0gkF2dy6zCGTpIk6CRpenGSsxO7PruBxOy@E/fO7Lqe2ZuTpv/pYA29k7y7dYrM87aqEbysBnD@trjGJwjht@c5UNeH054bgZGHA0dzX@MfiVHgzuOhgDe715wWmCEweYRot8bs2g/MOMANWoSZNUVZqT6GgP/N@KQ/795hvgDfKmqz1oY3ZhBmbVdnqU7SrMuKN3rQRYVcBzwMNsN5zuYLij1JHpKkyANeZDZdl22M39twEGyWjw80/BNlrS0US8Q8O2HW2/1JV5irK7IrDebuZnibJfirp5cXHx7B//j0@Rm3V59W6w9fnrNzuxqhhQEhX@tGyYOQBpdPEtewWCefXza2GX/bNk3bGH//AA "PHP ‚Äì Try It Online")
Input from command line, output to `STDOUT`:
```
$ php lucky.php 99 3333
8
$ php lucky.php 0 2522
3
$ php lucky.php 0 abaa
3
```
[Answer]
# [Stax](https://github.com/tomtheisen/stax), 23 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
¬ø^‚à©√ª:¬∂√°‚ò∫‚Åø¬£z‚åê‚îî‚â§‚ôÇEM¬•t(,5‚ïì
```
[Run and debug it](https://staxlang.xyz/#p=a85eef963a14a001fc9c7aa9c0f30b454d9d74282c35d6&i=++0++++[1,4,2,5]%0A+95++++[3,1,2,4]%0A+25++++[2,3,4,3]%0A+25++++[4,5,5,4]%0A++0++++[2,5,2,2]%0A+22++++[1,1,1,1]%0A+23++++[3,3,3,3]%0A+99++++[3,3,3,3]&a=1&m=2)
This program uses any arbitrary set of 5 integers for icons.
### Procedure:
1. Add up the number of occurrences of each element.
2. Divide by 2 and then mod 7.
3. The result is a number from 1..5. Use this to look up the coin prize in a fixed array.
4. Add to the initial coin count.
5. Divide by 100.
Here's the output from an experimental stack state visualizer I've been working on for the next release of stax. This is an unpacked version of the same code with the stack state added to comments.
```
c               input:[2, 3, 4, 3] 25 main:[2, 3, 4, 3] 
{[#m            input:[2, 3, 4, 3] 25 main:[1, 2, 1, 2] 
|+              input:[2, 3, 4, 3] 25 main:6 
h7%             input:[2, 3, 4, 3] 25 main:3 
":QctI*12A"!    input:[2, 3, 4, 3] 25 main:[300, 777, 10, 100, 200] 3 
@               input:[2, 3, 4, 3] 25 main:100 
a+              main:125 [2, 3, 4, 3] 
AJ/             main:1 [2, 3, 4, 3] 
```
[Run this one](https://staxlang.xyz/#c=c+++++++++++%09input%3A[2,+3,+4,+3]+25+main%3A[2,+3,+4,+3]+%0A%7B[%23m++++++++%09input%3A[2,+3,+4,+3]+25+main%3A[1,+2,+1,+2]+%0A%7C%2B++++++++++%09input%3A[2,+3,+4,+3]+25+main%3A6+%0Ah7%25+++++++++%09input%3A[2,+3,+4,+3]+25+main%3A3+%0A%22%3AQctI*12A%22%21%09input%3A[2,+3,+4,+3]+25+main%3A[300,+777,+10,+100,+200]+3+%0A%40+++++++++++%09input%3A[2,+3,+4,+3]+25+main%3A100+%0Aa%2B++++++++++%09main%3A125+[2,+3,+4,+3]+%0AAJ%2F+++++++++%09main%3A1+[2,+3,+4,+3]+&i=++0++++[1,4,2,5]%0A+95++++[3,1,2,4]%0A+25++++[2,3,4,3]%0A+25++++[4,5,5,4]%0A++0++++[2,5,2,2]%0A+22++++[1,1,1,1]%0A+23++++[3,3,3,3]%0A+99++++[3,3,3,3]&m=2)
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 72 bytes
```
O`\D
(\D)\1{3}
777¬∂
(\D)\1\1
300¬∂
(\D)\1
100¬∂
\D{4}
10¬∂
\d+\D*
$*
1{100}
```
[Try it online!](https://tio.run/##K0otycxL/K@q4Z7w3z8hxoVLI8ZFM8aw2riWy9zc/NA2KD/GkMvYwADO5TIEc2Jcqk1qgWwQM0U7xkWLS0WLy7AaKFn7/7@bs0@IAZeTm4@zpSmXj5Ozk5Epl3NIiDOQ8gnx8THgcgMCIyMuJyAwMgZTlpYA "Retina 0.8.2 ‚Äì Try It Online") Link includes test cases. Takes input as 4 printable ASCII non-digits followed by the initial number of coins in digits. Explanation:
```
O`\D
```
Sort the non-digits so that identical symbols are grouped together.
```
(\D)\1{3}
777¬∂
```
Four-of-a-kind scores 777.
```
(\D)\1\1
300¬∂
```
Three-of-a-kind scores 300.
```
(\D)\1
100¬∂
```
Each pair scores 100, so two pairs will score 200.
```
\D{4}
10¬∂
```
If there were no matches then you still win!
```
\d+\D*
$*
```
Convert the values to unary and take the sum.
```
1{100}
```
Integer divide the sum by 100 and convert back to decimal.
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 56 bytes
```
(\D)\1{3}
777¬∂
w`(\D).*\1
100¬∂
\D{4}
10¬∂
\d+\D*
*
_{100}
```
[Try it online!](https://tio.run/##K0otycxLNPyvquGe8F8jxkUzxrDauJbL3Nz80Dau8gSQiJ5WjCGXoYEBUCDGpdqkFsgGMVO0Y1y0uLS44quBcrX//7s5@4QYcDm5@ThbmnL5ODk7GZlyOYeEOAMpnxAfHwMuNyAwMuJyAgIjYzBlaQkA "Retina ‚Äì Try It Online") Link includes test cases. Takes input as 4 printable ASCII non-digits followed by the initial number of coins in digits. Explanation:
```
(\D)\1{3}
777¬∂
```
Four-of-a-kind scores 777.
```
w`(\D).*\1
100¬∂
```
Each pair scores 100. The `w` takes all pairs into consideration, so that they can be interleaved, plus three-of-a-kind can be decomposed into three pairs, thus automagically scoring 300.
```
\D{4}
10¬∂
```
If there were no matches then you still win!
```
\d+\D*
*
```
Convert the values to unary and take the sum.
```
_{100}
```
Integer divide the sum by 100 and convert back to decimal.
[Answer]
# APL+WIN, 42 bytes
Prompts for icons followed by coin stock.
```
  ‚åä(.01√ó‚éï)+.1‚åà+/1 3 7.77√ó+‚åø(+‚åø‚éï‚àò.=‚ç≥5)‚àò.=1‚Üì‚ç≥4
```
[Try it online! Courtesy of Dyalog Classic](https://tio.run/##TYxNCsJADIX3OUWWLaVjMz@ULryBHqJUKkJBoSsv0BapIojUe3gAF71JLjKm40YehPclea88NenuXDbHfVo1ZdseKs@353bD3d0AD33tebxEKqN5kn2cKOJxSFaEBnOV5/OU8PiJliFnHl5qzde3i4Mj7h5C1kuPr4HQokYHGdRgkMRbKJyAljKLBvQCFp3I/kDe5U2HCGEQaB3yQaDNHxTFFw "APL (Dyalog Classic) ‚Äì Try It Online")
[Answer]
# [Bash](https://www.gnu.org/software/bash/), ~~76 75 71~~ 70 bytes
***-4** thanks to @JonathanAllan, **-1** by rearranging the ternary.*
```
read c
for i;{ for j;{ ((a+=i<j));};}
echo $[!a?7+(c>22):a-6?6-a:c>89]
```
Bash port of my Zsh answer. 
~~[Try it online!](https://tio.run/##PY3BioNAEETv/RV1kDCDDImtJjG6yYcse5gdRxwRB2JIDku@3W1lWYqmqovX9Led@@XVh9Hj7m2LMUy@RhvJP@2I2T9gDJK1JRfDNH8kGc196B6klu3AURfvCPUPVh/ElQpm2O1smmpdv@s3eddHJJ/2pqzJ@HY0ds8Xdz1X@nJKlbsy669Fo2kaJNsTauPklwOQoQCjpKpELgujIC7FcunzNRYoRQUJK5wME7OQm4hz/Imq6j/@Ag "Bash ‚Äì Try It Online")
[Try it online!](https://tio.run/##PY1RC4JAEITf91dM4MMdIeWqlan1Q6KH67zwQjzIqIfot9sqEcMys8O37MUM7fhqfedwd6ZB53tXognknqbD4B6IY0RTSzb4fqijhIbWXx@kxvnA0jXc4cs3Jr@JK2WWtV/UN63LT/khZ9uA6GSOysQJHzexWfHeHnaF3m@Xyh6Y9XnUqKoK0fyDmtC7cQ0kyMDIqciRysLIiHOxVPp0ihlyUUbCCifDxCzkLOIUP1FR/OMX "Bash ‚Äì Try It Online")
[Try it online!](https://tio.run/##PYzNCsJADITveYo59LCLFDRt1f5YH0Q8rNuVbildsKIH6bPXtIgMYSbDl9zM2M7v1vcOD2ca9H5wJZpA7mV6jO6JOEa0tGSDH8ZTtKOx9fcnqXk9sHQPD/jyg8U7caXM5uSrTutyKidytg2ILuasTLw/72NT2PqY6@KwUbZm1tdZo6oqROt/asLg5i2wQwpGRnmGRBZGSpyJJdInS0yRiVISVjgZJmYhVxEn@Iny/B@/ "Bash ‚Äì Try It Online")~~
[Try it online!](https://tio.run/##PYxRC4JAEITf91dM4IMiQq5amZo/JHq4zhNPxAONeoh@u60SMSwzO3y7dzV3y6uzg8FkVIPBjqZA48g81YDZPBBF8NaWtLPjXHkxzZ1tH@Qv24Gm1k2wxRur9@K@r8LKln0QFJ/iQ0Z3Dt51p@pj6OsLc3BW0aE@ROqsL6f8tgQoyxLe9p4aN5plD8RIwcgoz5DIwkiJM7FE@mSNKTJRSsIKJ8PELOQm4gQ/UZ7/4xc "Bash ‚Äì Try It Online")
[Answer]
# [C (gcc)](https://gcc.gnu.org/), ~~92 84 82 81 79~~ 78 bytes
***-1** by `x+=(..!=..)` **-5** by [returning via assignment](https://codegolf.stackexchange.com/questions/2203/tips-for-golfing-in-c/106067#106067), **-4** thanks to Jonathan Allan by replacing `!=` with `<`, which saves bytes elsewhere, **-1** by rearranging the ternary.*
*From @ceilingcat: **-2** by declaring `i` and `x` outside the function, **-1** by setting `x=i` and decrementing `x` instead.*
```
i,x;f(c,a)int*a;{for(i=x=16;i--;)x-=a[i/4]>=a[i%4];c=x?x-6?6-x:c>89:7+(c>22);}
```
Another port of my Zsh answer. I'm unfamiliar with C golfing, there's probably another trick somewhere in here to reduce it further.
~~[92](https://tio.run/##VVDRaoQwEHzWr0ivHCR15UyM1/NS7/7AH7B5sDktoW0s9gqC@O12o@1B2cAw7DCzGRO/GjPPLTVQM@uuD7UaEYgt@B6GIlFt11Nl41ixISrqyu6kvvO4lVr1zfW7d2Q40yHm4ryPh504mtMhZ8fHiJqTEExN80dtHWXhGAb3l6a1riElOYSBT3l578zbV1XqSmpSEJQEIwcJArIJPEmBI5ErEZDiLl2JhAzntslQJlbCYZk/g2X@kzCY1HqA6azz@T48gRxdlpeAQLsU8twLfQVLJ6hKFMITKRGiiKHpZ4@rlm62l2e3AYJFLpZWw@/nrGZMhdP8Aw "C (gcc) ‚Äì Try It Online")
[84](https://tio.run/##VVBBboMwEDzjVzipItllUbAxaYhL8gM@QH2gToistlClPVhCvJ2uoa0UjaXRaEcz3rXJ1dppapmFhrvu@7HRAxJ1pdiBL1Pd9jemXZJo7uOyqd1WmVXgjTLalv7EfCLkaZf4rTzY477gh6eY2aOUXI/TR@M6xslAoofzpXXdhVZ0T6JQ8Pre27evujK1MrSkaIkGAQok5CMEkYFAoRYhIcNZtggFOeJ/kqNNLkLAjL@AGfeCRKNePmB714X@UJ5CgSnzS0FiXAZFEYxh@/kc6Eo10jOtkOKYY@jnDUctW2/OL90aKN5wjnQGfpdzhnNNxukH "C (gcc) ‚Äì Try It Online")
[82](https://tio.run/##VVDRaoMwFH3WrwgdhWRemcboatO0f@APuDy4tI7QLo5uDwHx292NboNxAofDOZybe036Zsw899RAx6z7euzkiESsyivwKpP9cKfSpqlkPlFda5@EPiBthZZG@RP1aXWqUr83x13N9s8JNUfOmZzm9846yuIxjh7Ol966C2nILo5C@ettMNfPttGt0EQRjERjDgI4lBMEUUCOQqyCQ4FesQoBJeLPKTHGV5HDgt@CBf9FHE1y/YAZrAvzw/AMamxZXgYc6wqo6xAMmy@nwFQmkQ6kQUoShqUfd7R6utmeX9wGCN5vqbQafpazmjEZT/M3 "C (gcc) ‚Äì Try It Online")
[81](https://tio.run/##VVBBboMwEDzjV7ipItllUcEYGuKQ/IAPUB@oEyqrLVRpD5YQb6dr01aKxtJoNKNZ75rk1Zhl6ZmBjtvh@6FTExK1dVaCq1PVj1embJIo7uK6a@2j1AekrdTK1Hfu9BQzcxSC711SnsrE7c1xV6l5@ejswDiZSHR/vvR2uNCG7kjku1/eR/P21Ta6lZrWFCPRlIEEAcUMXuSQoZCrEJCjl69CQoH4dwqMiVVkEPBXEHArSDSr9QNmtIOf74enUGFLeCkIrMuhqnzQLx4ugalUIR1ogxTHHEs/r2j1bLM9Pw8boHi@UGk1/C5nNeeKzMsP "C (gcc) ‚Äì Try It Online")
[79](https://tio.run/##VVBBboMwEDzDK6xUkXBZVDCGhjgkP@AD1AfqhGqV1FRpD5YQb6draCtVY2k0mtHsrk3yZsw8IzjVRwY6jvbrsVMj1lmp@uEeuTpVmCSKu7juWnyS@kC0lVqZ2p1cUp7KxO3NcVftn@PIHIXgaprfO7QRD8cweDhferQX1rBdGFA5e70N5vrZNrqVmtWMIsGYgQQBxQRe5JCRkKsQkJOXr0JCQfhzCoqJVWSw4LdgwX8RBpNaFzADWj/fD0@hopblpSCoLoeq8kF/ug8jpVJFdGANURxzKv24k9VHm@35xW6A0cctlajh5zjUnKtwmr8B "C (gcc) ‚Äì Try It Online")~~
[Try it online!](https://tio.run/##VVDRaoQwEHzWrwhXDkzdUI3RnpfG@wN/wMuDzZ1laavl2oeA@O121bZQJjAMM8zuxokX5@YZwesuctBy7L/uWz12wy1C401aaBRCcy9M2@CDstXCe2W1M/7kRXEqhD@66lAeH@PIVVJyPc3vLfYRD8cwuLtcO@yvrGaHMKBu9vw2uNfPpraNsswwigRjCgok5BMsIoOUhNqEhIy8bBMKcsKfk1NMbiKFFb8FK/6LMJj0toAbsF/mL8MTKKllfQlIqsugLJfgej6FkVKJJnpiNVEccyr9uJHVRbv95dzvgNG/rZVo4ec4tJzrcJq/AQ "C (gcc) ‚Äì Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~20~~ ~~19~~ 18 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
D¬¢<OR;—Ç*777T)√Öm+—Ç√∑
```
Port of [*@JonathanAllan*'s Jelly answer](https://codegolf.stackexchange.com/a/190171/52210), so make sure to upvote him!!  
-2 bytes thanks to *@Grimy*.
Takes the list of icons as first input (being `[1,2,3,4,5]`), and the amount of coins as second input.
[Try it online](https://tio.run/##yy9OTMpM/f/f5dAiG/8g64tNWubm5iGah1tztS82Hd7@/3@0oQ4YxnIZGQEA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfWVCceh/l0OLbPyDrC82aZmbm4doHm7NjdC@2HR4@3@d/9HRBjrRhjomOkY6prGxOgrRlqY60cY6hkC@CZhvBOQb6RgDVRjD@SY6pkAIkTcASZsClRtBpI1AxoEhhG8MMg4MIcZbIvFjAQ). (The test suite uses `T‚Äö√†+` instead of `TMI+`, which is an equal bytes alternative.)
**Explanation:**
```
D                   # Duplicate the first (implicit) input-list
 ¬¢                  # Count the amount of occurrences in itself
  <                 # Decrease each count by 1
   O                # Sum these
    R               # Reverse it
     ;              # Halve it
      —Ç*            # Multiply by 100
        777         # Push 777
           T        # Push 10
            )       # Wrap all three values into a list
             √Öm     # Get the median of these three values
               +    # Add the second (implicit) input to it
                —Ç√∑  # And integer-divide it by 100
                    # (after which the result is output implicitly)
```
[Answer]
# [Scala](http://www.scala-lang.org/), 88 bytes
```
(c,v)=>(Seq(777,300,200,100,0,10)((v.groupBy(x=>x).map(_._2.size+1).product-5)/2)+c)/100
```
[Try it online!](https://tio.run/##TY/RasMwDEXf/RWmTxJ13ViJCR2ksL0N9tYPCJmblows8RI3ZBv7dk/ZwphAQofLvUijq9oq9s8vtQvSyXoOdXce5b338lOIqWrl5Q4eu6BOYWi6KxZHhiKCUxPvcKrfIM9zlSaJIm7DvUwEmPR16G/@4R3m4jijfq08lLokPTYf9dag9kN/vrmws7gn3Drcszk@NWMAAVImSm5MRnaDQoE8WMbUUPaLtCClWfoPM2tX9cdLlmhVaYniWjFdorjW5MMfohbLkXyu519D28EFZl0aJXkSIoqvGL8B "Scala ‚Äì Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 30 bytes
```
‚âî‚äòŒ£Ôº•Œ∑‚ÑñŒ∑ŒπŒ∑Ôº©‚åä‚Å∫‚àïŒ∏¬π‚Å∞‚Å∞‚à®‚ÅªŒ∑‚àï¬≤‚à®‚Ä∫‚Å∏Œ∑‚Åπ‚àï¬πœá
```
[Try it online!](https://tio.run/##bUw9D4IwFNz9FQ3TI3kmgIuGSTHqQiRxJAwNNLTJs9UW@Pu1JYzecpf76iW3veHk/dk5NWp4cFrEAK/5DTX/gERWmVlPUag0AJlMy11jVfAq7ia4kTEWGpodXNWiBgFfZHmWhebTQq10CMJ4y4rVvVvBJ2HhGN@QneLtVsjjOF1Ret8WB2RtchFECbL/3HV@v9AP "Charcoal ‚Äì Try It Online") Link is to verbose version of code. Takes input as the number of coins and an array of any Python comparable values as icons. Explanation:
```
‚âî‚äòŒ£Ôº•Œ∑‚ÑñŒ∑ŒπŒ∑
```
Shamelessly steal @GammaFunction's trick of computing half the sum of counts.
```
‚ÅªŒ∑‚àï¬≤‚à®‚Ä∫‚Å∏Œ∑‚Åπ
```
Subtract `2` from the sum, thus resulting in the values `0, 1, 2, 3` appropriately, but for 4-of-a-kind, divide the `2` by `9` first, resulting in `7.777...`.
```
‚à®...‚àï¬πœá
```
But if the result is 0, then there were no matches, so replace it with `0.1` instead. (Using a literal doesn't help me here because I would need a separator.)
```
Ôº©‚åä‚Å∫‚àïŒ∏¬π‚Å∞‚Å∞...
```
Divide the initial coins by 100 and add on the winnings, then floor the result and cast to string for implicit output.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 32 bytes
```
AQ-@[+K2/G90J/sm/HdH2+9>G22)/J3K
```
[Try it online!](https://tio.run/##K6gsyfj/3zFQ1yFa29tI393SwEu/OFffI8XDSNvSzt3ISFPfy9j7//9oI1OdaBMdUyA0iY0FAA "Pyth ‚Äì Try It Online")
Inspired by GammaFunction's solution. Takes input as `[coins, [icons]]`.
```
AQ                               # Q is the input. Set G := Q[0], H := Q[1]
    [                      )     # Construct a list from the following entries:
     +K2/G90                     # [0] (K:=2) + G/90 (/ is integer division)
            J                    # [1] J:=
              s                  #        reduce on + (
               m   H             #          map entries of H as d on (
                /Hd              #            number of occurences of d in H ) )
             /      2            #                                               / 2
                     +9>G22      # [2] 9 + (G > 22)
   @                        /J3  # Take element at position J/3
  -                            K # Subtract K (=2)
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), 94 bytes
```
param($n,$l)$r=@{2=100;3=300;4=777}[($l|group|% c*t)]|?{$_;$n+=$_}
+(($n+10*!$r)-replace'..$')
```
[Try it online!](https://tio.run/##bY7xToMwEIf/5ynqcnPtKAu0EMTZuPcwhhDs1KQCFlAT4NnxZIxpYi9tk6/f765V@alt/aKNGeGourHKbPZGoeBgGFh16IQKfH8vlcQzVHEcDw8UTP9sy7bq1yTfNuyxv@8g3UPhKkgHx6WYdwN/ewWWeVZXJsv1ZreDDRsHxzlQh@Di1OeE4KYBD7ngEWMX7ot/eMBJEiGXPEAe/ubihwsuMSEXLmYe8gjr4st5LvbGPmLhMfqnuVMt/Aa5nHzxx0eeJNN/pkLOSE/WpJveQX9VOm/0EyeQl69FjfdHZlpdE0UgPTlW161pEFzDcdbO1iSsgM6Ol@v3pSW7XaJ33jlH5yBbOcP4DQ "PowerShell ‚Äì Try It Online")
Unrolled:
```
param($nowCoins,$values)
$groupCounts=$values|group|% count
$rewardedCoins=@{2=100;3=300;4=777}[$groupCounts]|?{
    $_                          # output matched only
    $nowCoins+=$_               # and accumulate
}
$nowCoins+=10*!$rewardedCoins   # add 10 coins if no rewarded conis
+($nowCoins-replace'..$')       # truncate last two digits
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~114~~ 107 bytes
-7 bytes thanks to mazzy
```
param($n,$l)((((0,.1,1)[+($x=($l|group|% c*t|sort))[2]],2,3)[$x[1]-1],7.77)[$x[0]-eq4]+".$n")-replace'\..*'
```
[Try it online!](https://tio.run/##RY1BDoIwEEX3nIKYKi0MDS0QwoKTYBeEFF1UwIKRRDw7DkjC/NW8vPnTd29th7s2ZiFN8Vn6ylYPSloghlGcCLgAwcqAkqmgxMw32736@ezW/jgPnR0ZK6VSICFmJZlKoUKhIONZtq2RCvUzUcGJk/bEQqt7U9Xau3Lue8vXcS6kcaPIpQISrEjZBvLUpTEIBMkfSAT4AJ34AAmkmN1YO/AeT@RuyLV0yw7i1ZCHkefrly1s@QE "PowerShell ‚Äì Try It Online")
A big ol' PowerShell-flavored ternary operation built upon grouping and sorting the counts of the input list. The sort is needed because we leverage the fact that the grouped list gets shorter the more repeats there are. In fact, here's all the possible values:
```
(1,1,1,1)
(1,1,2)
(2,2)
(1,3)
(4)
```
Truncating to an int is still expensive.
Unrolled:
```
param($n,$l)
$x=$l|group|% c*t|sort
(((                      #Start building a list...
   (0,.1,1)[+$x[2]],     #where spot 0 holds dummy data or handles no match and 1 pair
    2,3)[$x[1]-1],       #Overwrite the dummy data with 2-pair or 3-o-k
   7.77)[$x[0]-eq4]      #OR ignore all that and use spot 1 because it's a 4-o-k
   +".$n"                #Use that value and add CoinCnt via int-to-string-to-decimal
)-replace'\..*'          #Snip off the decimal part
```
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 54 bytes
```
‚åä{,.1,1,2,3,,,7.77}[[Total[Counts@#2^2]/2]]+.01#‚åã&
```
[Try it online!](https://tio.run/##TY1LCsIwFEXnXUUh0InPfl5aSgdKwA04cBYiBLFYsC1oHIVsQLvKbiTmAyJ3dLiXc0epbtdRquEibb@z6/LWkFdQAQIFgDZvW8P5aVbyzg/za1JPRvCMokAhNnlZkXX5ZPb4GCbFyXbfM0ZEVjCd6DIF7TU1NMZAorsGNA3iOjA69ic10B@7rUvsS0hd37g9xh69LyQy9b6Q6O/@ODH2Cw "Wolfram Language (Mathematica) ‚Äì Try It Online")
[Answer]
# R, ~~102~~, ~~91~~, 81 bytes
```
f=function(b,v,s=table(v))(477*any(s>3)+b+10*all(s<2))%/%100+sum(s==2)+3*any(s>2)
```
Managed to drop 11 bytes (and fix a bug) thanks to @Giuseppe.
Managed a further 10 inspired by by @Giuseppe's /10 idea.
Ungolfed
```
f=function(b,v){
  s = table(v)          #included in fn inputs
  a = b+10*all(s<2)     #covers all different case
  a = a+477*any(s>3)    #Covers 4 of a kind
  d = sum(s==2)+3*any(s>2) #covers 1 and 2 pair, 3 of a kind.
  a%/%100+d         #sum appropriate values
}
```
[Try it online!](https://tio.run/##TY1RCsMgEAX/e4/AblyorkoI1N4lCRUK1kJNAjm9tVpomb9h9u0rZ@/8Fpf1/oww007JrdMcbrAjghmGfooHpKtGMQsl@ykESBdG7M6dklKk7QHJOUahvyVj9iBpAUWGmCziycNoi9CkijBV8Ecw6dLonzBkC62QNbDlglvAdbPShK6blfZk/Bf5DQ)
[Answer]
# 8051 Assembly (compiles to 158 bytes)
This is a VEEEEEEEEEERRY naive approch, this is yet untested and ungolfed but im pretty confident that works. Things to consider are: 
1) the 8051 is an accumulator machine ie. it needs mov instructions that other architectures may not need at all.
2) the 8051 is an 8bit machine therefor there has to be done some trickery for the numbers >255 which makes for more code and is therefor a disadvantage of the platform over the others.
```
CSEG AT 0000H
coinStackOnes equ 0xf3
coinStackTens equ 0xf4
coinStackHundreds equ 0xf5 ; leave one byte as guard so that if that gets corrupted it doesnt really matter
values1 equ 0xf7
values2 equ 0xf8
values3 equ 0xf9
values4 equ 0xfa
numOfFlowers equ 0xfb
numOfLeaf equ 0xfc
numOfBell equ 0xfd
numOfCherry equ 0xfe
numOfBoomerang equ 0xff
flower equ 1
leaf equ 2 
bell equ 3
cherry equ 4
boomerang equ 5
numOfHeartsReceived equ 0xf1
mov r1, #4
mov r0, numOfFlowers
clearNumOfRegs: mov @r0, #0d
        inc r0
        djnz r1, clearNumOfRegs
;if you reach this all numOfXXXX registers are zeroed
mov r0, #values1 
mov r1, #flower
mov a, #6 ; innercounter
mov b, #5 ; outercounter
checkfornextpossibleitem:   mov r2, a; backup countervar
                mov a, @r0 ; store given value in a
                xrl a, @r1 ; xor a with item
                jnz nextItem ; if value!=item -> nextitem
                mov a, #numOfFlowers ;if you end up here a=0 (ie value == item) --> generate addr for numOfReg <-- load a with addr for numOfFlowers
                add a, r1 ; since items are only numbers you can add the item to get the addr for numOfReg a=addr(numOfReg)
                xch a, r1 ; change the item with the addr as r1 is indirect register
                inc @r1 ; increment numOfRegister
                xch a, r1; r1 = item
                ;next item              
                nextItem:   inc r1 ; increment item
                        mov a, r2 ; restore counter
                        dec a; decrement counter
                        cjne a, #0, checkfornextpossibleitem 
                        ;if you reach this you have successfully tested one value against all items and therefor the next value must be tested
                        mov a, #6; reset the innercounter
                        dec b; decrement the outercounter
                        inc r0; increment the register that points to the value-under-test
                        xch a,b; cjne works with a but not with b therefor exchange them
                        cjne a, #0, here ; do the comparison; if you dont jump here you have tested all values 
                        jmp howManyPairsDoIHave; if you didnt jump above you have the now the number of flowers and so on
                        here:   xch a,b ; and change back
                            jmp checkfornextpossibleitem ; check the next value
howManyPairsDoIHave:    mov r0,#0; store numOfPairsHere initialize with zeros
            mov r1, numOfFlowers; 
            mov b, #6; use as counter to know when you went through all numOfRegisters
analyseNumOfRegister:   mov a, @r1 ; load the numOfregister for some math
            xrl a, #2; a will contain zero if numOfXXX = 2
            jnz numOfXXXWasNot2; if you do not jump here you have 2 XXX therefor 
            inc r0; increment the number of pairs
            jmp nextNumOfRegister; continiue with the next one
            numOfXXXWasNot2:    mov a, @r1; restore the number of XXX and try the next magic value
                        xrl a, #3; will contain zero if you have a three of a kind                      
                        jnz no3XXX; if you dont jump here however you have a three of a kind
                        jz add300Coins
                        no3XXX:     mov a, @r1; restore number of XXX
                                xrl a, #4; a will contain zero if 4 of a kind
                                jnz nextNumOfRegister; if you numOfXXX!=4 you can only continiue trying to find something in the next numof register
                                jz add777Coins; if you didnt jump above how ever you will have to add the 777 coins as you detected a 4 of a kind
nextNumOfRegister:  inc r0; move pointer to the next numofregister
            djnz b, analyseNumOfRegister; if you havent already analysed all numofregisters then continue
            ; if you have however you end up here so you will have to take a look at the numOfPairs
            cjne r0, #1, tryIf2Pairs; test if you have 1 pair if not try if you have 2
            jmp add100Coins; if you have 1 pair however add the 100 coins
            tryIf2Pairs:    cjne r0, #2, youMustHave0Pairs; test if you have 2 pairs if not you can be sure to have 0 of them
                    jmp add200Coins; if you have 2 pairs however add them
youMustHave0Pairs:  ; add 10 coins
            inc coinStackTens
            mov a, coinStackTens
            cjne a, #10d, howManyHearts ; if your tens digit isnt outta range continue with the calculation of the number of hearts
            inc coinStackHundreds; if it is outta range do correct that
            mov coinStackTens, #0
            jmp howManyHearts;
add100Coins:    inc coinStackHundreds; here the digit can not possibly have an invalid value...
        jmp howManyHearts
add200Coins:    mov a, coinStackHundreds
        add a, #2
        mov coinStackHundreds, a
        jmp howManyHearts ; also here no invalid values possible
add300Coins:    mov a, coinStackHundreds
        add a, #3
        mov coinStackHundreds, a
        jmp howManyHearts ; same again
add777Coins:    mov r0, #coinStackOnes
        mov r2, #3
add7:       mov a, r0
        mov r1, a
        mov a, @r0
        add a, #7
        mov b, a; b contains the possibly invalid version of the ones digit     
        da a; if you have an invalid value its lower nibble gets corrected this way
        anl a, 0x0f; and the higher one gets corrected this way
        xch a,b; a and b must be swapped in order to make subb work ie b contains now the corrected value and a has the maybe faulty value
        subb a,b; returns zero if all the corrections had no effect therefor the next digit can be increased by 7
        jz nextDigit
        inc r1
        inc @r1
        nextDigit:  inc r0
                djnz r2, add7;
howManyHearts:  mov numOfHeartsReceived, coinStackHundreds
loop_forever:   sjmp loop_forever
        END
```
]