You are a dealer at The One, the first all-binary casino in Las Vegas. What makes The One special is that its blackjack tables don't use cards; they use bytes (an 8-bit sequence representing a number from 0 to 255) and nibbles (a 4-bit sequence representing a number from 0 to 15).
All day long, you play the house's hand against individual opponents. Of course, the casino owners know their statistics, and they have devised a strategy for you that gives gamblers just less than even odds.
Here are the rules of binary blackjack:
- The goal of the game is to be the player closest to 510 points without going over.
- Each player is dealt two bytes, one face up and one face down.
- The players then have the opportunity to take more bytes (by saying, "Byte Me!") or more nibbles (by saying, "Nibble Me!") until he reaches his limit of 4 hits or has more than 510 points showing.
- All hits are played face up.
- If a player goes over 510, he immediately busts and loses the hand.
- The dealer hits last.
- The dealer wins any ties (this includes a tie where everyone busts).
The rules for the dealer are (in order of precedence, where lower numbered rules override higher numbered ones):
- Never hit when it is certain that you've won by simply looking at your hand and what is showing of other people's hands.
- If your total is strictly less than 382 take a byte hit.
- If your total is less than or equal to 500 take a nibble hit.
- Take no hits