#x86-16 Assembly, IBM PC DOS, 56 bytes **Binary:** 00000000: 50b1 0433 d2ac 8bfe 51f2 ae75 0342 ebf9 P..3....Q..u.B.. 00000010: 923c 0375 0481 c3dd 013c 0275 0481 c3c8 .<.u.....<.u.... 00000020: 003c 0175 0383 c364 59e2 d885 db75 02b3 .<.u...dY....u.. 00000030: 0a58 03c3 b264 f6f2 .X...d.. **Unassembled:** 50 PUSH AX ; save original coin count B1 04 MOV CL, 4 ; set up loop counter for 4 digits DIGIT_LOOP: 33 D2 XOR DX, DX ; clear match counter AC LODSB ; next digit char into AL 8B FE MOV DI, SI ; start searching at next char 51 PUSH CX ; save outer loop counter MATCH_LOOP: F2/ AE REPNZ SCASB ; search until digit AL is found 75 03 JNZ CHECK_RES ; end of search string found 42 INC DX ; otherwise a match was found, inc counter EB F9 JMP MATCH_LOOP ; continue looping CHECK_RES: 92 XCHG DX, AX ; save match results to AX for shorter compare 3C 03 CMP AL, 3 ; is four of a kind? 75 04 JNE CHECK_THREE ; if not, check for triple 81 C3 01DD ADD BX, 477 ; if so, add 477 to score CHECK_THREE: 3C 02 CMP AL, 2 ; is three of a kind? 75 04 JNE CHECK_TWO ; if not, check for double 81 C3 00C8 ADD BX, 200 ; if so, add 200 to score CHECK_TWO: 3C 01 CMP AL, 1 ; is two of a kind? 75 03 JNE END_LOOP ; if not, move on to next 83 C3 64 ADD BX, 100 ; if so, add 100 to score END_LOOP: 59 POP CX ; restore outer loop position E2 D8 LOOP DIGIT_LOOP ; keep looping 85 DB TEST BX, BX ; was ending score 0? 75 03 JNZ DONE ; if not, go to calculate score B3 0A MOV BL, 10 ; consolation prize of 10 DONE: 58 POP AX ; restore original coins 03 C3 ADD AX, BX ; add earned score B2 64 MOV DL, 100 ; divide by 100 F6 F2 DIV DL ; result is in AL Input original coin count in `AX`, `SI` pointing to string of icons. Output number of lives in `AL`. This is not as golfed or clever as it can be. I only had as long as my daughter's nap to work on this today. :) Here is an test program for PC DOS that includes extra routines to handle the integer value I/O: [![enter image description here][1]][1] Download and test [LUCKY.COM][2] for DOS. [1]: https://i.sstatic.net/0XZfJ.png [2]: https://stage.stonedrop.com/ppcg/LUCKY.COM