“I’m starting to see the light,” sighed Monkey. “Perhaps the random move algorithm ain’t so good after all.”
“Told you so!” shouts the Elephant.
“Perhaps you should go back to your stupid typewriter,” yells the Dumb Bunny.
“Do the Harry Potter novels instead of Shakespeare!” shouts the Cat.
“Why, if it isn’t the Ninja Monkey descending from on high to mingle with the commoners!” sneers the Lion.
“We need to talk,” I say to Monkey.
“I think we might improve our odds of winning if, you know, we use some strategy.”
Monkey is confused and gives me the what-the-70,85,67,75-does-that-word-mean look.
“I was thinking … let’s say that once you have two cards in sequence then you never break it up.”
“Does that mean,” replies Monkey, “If I have Six of Spades and Seven of Spades then the 7-6 is never broken?”
“Correct, unless you move the Six of Spades onto the other Seven of Spades.”
I click my fingers.
It takes Monkey a mere ninety seconds to add another 200 to his not-so-impressive tally of 50 quintillion losses.
I notice the other animals are taking side bets. The Jackal thinks Monkey will persist for at least 40 minutes before giving up and is willing to bet $30. The Lion thinks otherwise and raises to $80. Meanwhile the Smart 65,83,83 is running an informal competition for who can come up with the cleverest insult(s).
“That’s interesting,” says Monkey. “I’ve noticed the number of in-suit builds never decreases. After any move it either stays the same or goes up by 1.”
“That’s very good,” I reply. “The more in-suit builds we have the closer we are to winning.”
“If only it were that simple,” sighs the Monkey.
“Now this next step might be tricky for a player like you – I want you to play S-L-O-W-L-Y for a change and then I can see where you are going wrong.”
Monkey redeals another hand. He pauses for five seconds before making each move. I can tell he is bored 83,72,73,84,76,69,83,83 and on the verge of crying. Fortunately he doesn’t have to wait very long before I find some serious deficiencies in his strategy.
“It’s good that you are never breaking in-suit builds, but the new problem is that you are missing opportunities to build in-suit. Go back to the very beginning, you see columns 1 and 9 contain the Ace and Two of hearts. Therefore you should start by moving the AH onto the 2H.
“So that means,” says Monkey “I should always build in-suit if possible. If I can’t build in-suit then build off-suit, but under no circumstances should I break an in-suit build.”
“That is correct.”
Monkey redeals another hand. After the first hand he shrieks with joy. He has managed to remove his first complete suit. But that doesn’t put an end to the bullying from all the other animals. It seems he has to remove all eight suits to put an end to it.
“I have a thought,” says the Wise Snail.
Of course I don’t expect any great insight from the world’s slowest player but given that he is not participating in the bullying I’m willing to listen for once.
“Maybe we can combine the two strategies,” says the Wise Snail. “Let us call the first strategy Level 1 – where we make random moves. At Level 2 we recognise that we should not break in-suit builds. Once the player reaches Level 3 he knows he should focus on increasing the number of in-suit builds. Once we have 96 in-suit builds we win the game.”
No fantastic insight from the Wise Snail yet, but I will give him credit for knowing how to do basic math.
“But let’s say we pick a random number between 0 and 1. If it is 0.9 or lower then we pretend we’re at Level 3. If it’s higher than 0.9 then we pretend to be Level 2.”
“But that sounds crazy,” I protest. “If both strategies have a win rate of zero then taking a weighted average should also yield a win rate of zero.”
“Not exactly,” replies the Wise Snail. “Ever heard of “Simulated Annealing?”
The snail starts moving about in the sand. It takes him a good 10 minutes to draw the figure below. I try to google Simulated Annealing on my iPhone but the reception ain’t great in the Animal Kingdom. Meanwhile, the Monkey is happily (or not so happily) adding to his tally of losses with the Level 2 and Level 3 strategies.
Oh Great, it looks like they’re now bullying the Wise Snail as well.
“Actually, I can’t remember whether it’s simulated annealing, stochastic hill climbing, or stochastic gradient descent, or something else” continues the Wise Snail. “In any case the details aren’t important. The x-axis represents the set of possible game states. The y-axis represents the number of in-suit builds you need to complete the game. Thus we win if the ball reaches the bottom the hill,”
“But occasionally we may need to avoid building in-suit,” I reply, “to achieve a greater gain, such as an empty column. Under the right circumstances we may even decrease the number of in-suit builds, but that’s a lesson for later.”
“Correct,” says the Wise Snail. “Assume the ball can only see a local neighbourhood of the terrain. If the ball moves randomly then it will take a long time, but if the ball moves to the local minimum then it will get stuck.”
I nod in agreement.
“But we can combine the two algorithms. Let us say that we spend 90% of the time moving towards a local minimum and 10% of the time moving rando-”
“I see where you’re coming from,” I reply.
“Unfortunately I don’t know how to explain this simulated annealing/stochastic hill climbing/stochastic gradient descent/something else thingy to the Monkey.”
I turn to the monkey and signal him to stop playing.
“Import Numb Pie As N. P.”
Monkey eagerly nods, awaiting further instruction.
I ignore the rest of the gang as the Bad Idea Bears take bets on how many syntax errors I accumulate before the Monkey starts playing again.
<<Three hundred and twenty five syntax errors later>>
I click my fingers. The Smart 65,83,83 curses his off-by-one error, having bet on 324 instead of 325. There are no prizes for coming closest – only an exact guess takes the jackpot. The B.I.B. are content with their tidy profit. At least I have no more syntax errors. Unfortunately the Monkey loses another 100 games in a row.
“Okay,” sighs the Wise Snail. “Maybe it’s not working after … ”
“MONKEY DID IT, MONKEY DID IT, MONKEY REMOVE ALL CARDS, FOUR SUIT WITHOUT UNDO, GAME 115 MONKEY DID IT!!!!”
“Liar!” calls the Eagle. “Monkey is BLUFFING!!!!!!”
“I am 100% certain Monkey removed all eight suits in Game 115,” I say matter-of-factly.
“You were having a quiet discussion with your Wise Snail friend” sneers the Eagle.
“$500 says I can prove Game 115 is a win.”
“I raise all-in, Three thous-”
I call so fast Eagle doesn’t even have time to say “and”.
I click my fingers and Monkey deals 200 hands. Of course I have remembered to seed Monkey’s random number generator with my Tax File Number. As predicted, Monkey wins the 115th game out of 200 and loses every other game. The Eagle is not happy. My two worst students have teamed up and somehow managed to beat the game at the Four-Suit level (something the Eagle has never managed). Moreover, in one night my best student has squandered all her penny-game poker winnings accumulated in the past three months. As an extra bonus, the constant bullying from all the other animals has mysteriously stopped. I can’t say everybody lived happily ever, but at least it’s a step in the right direction 😊