Can't see emoji? Click here.

You will simulate a vending machine. The items are 56 different emojis, which can be represented as two surrogate UTF-8 characters, from: 🍅(U+D83C U+DF45) to 🍼 (U+D83C U+DF7C). In HTML these emojis can be represented in UTF-16 form as &#x1F345 through &#x1F37C. In base 10 the first UTF-8 character has value 55356. The value of the second character ranges from 57157 to 57212. Here is a CJam program that generates all the relevant emojis. To avoid confusion, this challenge will be scored in characters, not bytes. Some emojis are 2 characters, some are 3. http://www.lettercount.com will give you an accurate count for this challenge.

Pricing 💵💵💵

There are 8 different price categories:

Displaying the Vending Machine

This is what the user sees when the program starts and after making a purchase. You can use regular numbers instead of emoji numbers, but emoji numbers have the benefit of being the same width as other emojis. If you use emoji numbers you can subtract 14 characters from your score, because emoji numbers are 3 characters each.

  1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣
A 🍅🍆🍇🍈🍉🍊🍋
B 🍌🍍🍎🍏🍐🍑🍒
C 🍓🍔🍕🍖🍗🍘🍙
D 🍚🍛🍜🍝🍞🍟🍠
E 🍡🍢🍣🍤🍥🍦🍧
F 🍨🍩🍪🍫🍬🍭🍮
G 🍯🍰🍱🍲🍳🍴🍵
H 🍶🍷🍸🍹🍺🍻🍼 

If the user enters G5 that selects 🍳. Entering E6 selects 🍦.

Adding Cash 💸💸💸

To add money, the user should input / and then the code for a coin or bill. The coins are (N)ickel ($0.05), (D)ime ($0.10), and (Q)uarter ($0.25). The bills are (O)ne ($1.00), (F)ive ($5.00), (T)en ($10.00). Every time the user adds a bill or coin, the program should output Balance: [New Balance]. Only one bill or coin can be added each time.Here is an example containing three lines of input:

/D
Balance: $0.10
/Q
Balance: $0.35
/F
Balance: $5.35

Selecting Items

The user selects an item by entering the item code, like B2 or C3. If the user has not added any money, the program should output Item Cost: [Cost of Item]. If the user has added money, but it is not enough to buy the item, the output should be Insufficient Funds. Item Cost: [Cost of Item]. If the user did add enough money, the program should output: Item at [Item Location] Purchased. Remaining Balance: [Balance - Cost of Item]. Then on its own line, print out the emoji of the purchased item. Then print out the entire vending machine (See "Displaying the Vending Machine") with the purchased item replaced with 🚫(U+D83D U+DEAB) Base 10: (55357 57003).

Ending the Program

If the user buys an item which brings his/her balance down to $0.00, the program should automatically terminate. Alternatively, if the user enters "Done" at any time, the program must give the user his/her remaining balance in change. Change must be in only Nickels, Dimes, and Quarters, and must be the smallest amount of coins possible. For example if the remaining balance is $1.45, the output should be QQQQQDD.

Sample Run

(Input starts with "-")

  1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣
A 🍅🍆🍇🍈🍉🍊🍋
B 🍌🍍🍎🍏🍐🍑🍒
C 🍓🍔🍕🍖🍗🍘🍙
D 🍚🍛🍜🍝🍞🍟🍠
E 🍡🍢🍣🍤🍥🍦🍧
F 🍨🍩🍪🍫🍬🍭🍮
G 🍯🍰🍱🍲🍳🍴🍵
H 🍶🍷🍸🍹🍺🍻🍼  
-E1
Item Cost: $3.00
-/F
Balance: $5.00
-E1
Item at E1 Purchased. Remaining Balance: $2.00
🍡 
  1️⃣2️⃣3️⃣4️⃣5️⃣6️⃣7️⃣
A 🍅🍆🍇🍈🍉🍊🍋
B 🍌🍍🍎🍏🍐🍑🍒
C 🍓🍔🍕🍖🍗🍘🍙
D 🍚🍛🍜🍝🍞🍟🍠
E 🚫🍢🍣🍤🍥🍦🍧
F 🍨🍩🍪🍫🍬🍭🍮
G 🍯🍰🍱🍲🍳🍴🍵
H 🍶🍷🍸🍹🍺🍻🍼
-Done
QQQQQQQQ

Invalid Codes

Bonus (-15%) : Jam

When vending an item, there is a 10% chance the machine will jam, and the item gets stuck. Output JAM!!! one time. In this case the user must input "punch" or "kick". Each time the user does so, there is a 20% chance that the item will break free, and vend as normal. Until the jam clears, the only inputs recognized are "punch" and "kick". All other inputs do nothing. Here is a sample:

-A4
Item at A4 purchased. Remaining Balance: $1.00
JAM!!!
-punch
-kick
-kick
-punch
-punch
🍚

(The jam has been cleared. Resume as normal.)

Bonus (-10%) : ID

If the user tries to buy an alcoholic beverage (any item on the last row except the baby bottle), you must demand proof of age. To do so, you ask the user to multiply two random numbers between 13 and 19 (inclusive). Output ID required: [13-19]x[13-19] = ?. If the user answers correctly, the purchase can go through. If not, print 🔞(U+D83D U+DD1E) base 10: (55357 56606)

Alternative Challenge : Minecraft

This challenge seems like something possible in Minecraft. To successfully create a Minecraft version of this program, the player must

Compatibility Mode

function parse() {
var o = document.getElementById("output");
var text = document.getElementById("in").value;
o.innerHTML = text.replace(/\n/g,"<br/>").replace(/ /g,"&nbsp");
twemoji.parse(o);
}
<head>
<script src="//twemoji.maxcdn.com/twemoji.min.js"></script>  
</head>
<body>
<h1>Emoji to Image</h1>
<textarea id="in" rows="10" cols="50"></textarea>
<input type="submit" onclick="parse()">
<div id="output"></div>
</body>

edit the above snippet

Here is an abbreviated compatibility-mode version of the vending machine display that you can test in the Stack Snippet:

   &#x31&#x20E3&#x32&#x20E3&#x33&#x20E3&#x34&#x20E3&#x35&#x20E3...
A&#x1F345&#x1F346&#x1F347&#x1F348&#x1F349...
B 
...