Tales from the jar side: The Weasel Program, ApacheCon, A Groovy Podcast, Cheating in chess and elsewhere, and More funny tweets
What do you get when you cross a chicken with a fox? A fox.
Welcome, fellow jarheads, to Tales from the jar side, the Kousen IT newsletter, for the week of October 2 - 9, 2022. I spent this week in New Orleans, LA, presenting at and attending ApacheCon, the open source conference hosted by the Apache Software Foundation.
Regular readers of this newsletter are affectionately known as jarheads, and are far more intelligent, sophisticated, and attractive than the average newsletter reader. If you wish to become a jarhead, please subscribe using this button:
As a reminder, when this message is truncated in email, click on the title at the top to open it in a browser tab formatted properly for both the web and mobile.
Infinite Monkeys
There’s an old saying that if an infinite number of monkeys typed for an infinite amount of time, eventually they would produce all the works of Shakespeare. This phenomenon has a name — the infinite monkey theorem. The only problem is that the probability of typing any particular phrase is so small as to be virtually zero.
The evolutionary biologist Richard Dawkins noted that the low probabilities were sometimes used as arguments against evolution, in that random mutations would take far too long to produce anything organized, like actual proteins. He considered a somewhat smaller problem, known as the Weasel Program, which asks how long it would take a monkey bashing at random on a typewriter to produce the phrase METHINKS IT IS LIKE A WEASEL, using only capital letters and spaces. Since there are 27 possible characters (26 letters and a space) and the sentence is 28 letters long, the number of permutations is 27^28, or about 10^40, which is extremely low.
(The quote, btw, is from Hamlet (Act 3, Scene 2):
Hamlet: Do you see yonder cloud that’s almost in shape of a camel?
Polonius: By th’ mass, and ‘tis like a camel indeed.
Hamlet: Methinks it is like a weasel
Polonius: It is backed like a weasel.
Hamlet: Or like a whale?
Polonius: Very like a whale.
Polonius is just trying to agree with whatever Hamlet says, though there are other interpretations.)
The idea of the Weasel Program, however, is that each generated string is evaluated according to its fitness, and then modifies the fittest ones over time, and the result can be produced much more quickly. This cumulative selection process is far more efficient.
One of my talks at ApacheCon in New Orleans this week was about genetic algorithms, which implement this process. Each string in a random population of strings is considered a chromosome made up of genes, where each gene is an individual character. Then each one is evaluated according to its nearness to the desired string, and the closest (“fittest”) ones breed by crossover:
Each gene also undergoes a mutation, where characters are randomly changed according to a small probability. This helps avoid local minima.
(Figures from this blog post, used by permission.)
I demonstrated the Weasel Program in Java, using both the sample from the genetic algorithms section of Apache Commons Math and the similar Weasel Program from the Jenetics library. I included Paul King’s similar demos, written in Groovy.
Here is Paul’s script that uses Jenetics:
(Simple, right? Funny how everything Paul does winds up looking simple. Some of that is Groovy, but IMHO more of it is Paul. He’s good like that. :)
In any case, a typical run results in:
Starting evolution ...
Generation 0: (f=-523.0 'nTLM|K6T.Fv$HA='ElA81k8GIM+;') Generation 1: (f=-511.0 ';8{jBBdq6UF(XK-?Ujf_C&akJRVR') Generation 10: (f=-205.0 'LDUHH=IW&FT Ma aHBJ-E*YG&aV2') Generation 20: (f=-86.0 'LDUHLGQQ*KT MR EIND B&YGHM<P') Generation 30: (f=-41.0 'MDUHHMIR#IT MR EIND!=!XGAQBK') Generation 40: (f=-25.0 'MDUHHMIR IT HR NIND B!XGATBK') Generation 50: (f=-21.0 'MDUHHMIR IT HR NINE B!XEASBK')
…
Generation 230: (f=-1.0 'METHINKS IT IS LIKE A WEASDL') Generation 240: (f=0.0 'METHINKS IT IS LIKE A WEASEL') Generation 240: (f=0.0 'METHINKS IT IS LIKE A WEASEL')
Total execution time: 634ms
(Note: this was from the sample in Apache GA, written in Java, using both lowercase and uppercase letters as well as punctuation for the possible characters.)
I know I’ve discussed this topic in a newsletter before, but I don’t think I included my favorite related joke:
Me: What did you think of my book?
You: You know how an infinite number of monkeys on an infinite number of typewriters will eventually produce all the works of Shakespeare?
Me: Yeah, so?
You: Your book? Three monkeys, two days.
That, of course, reminds me to let you know that my book Mockito Made Clear is now available in its latest beta form. Feel free to use the coupon code kkmockito35 on checkout for a 35% discount. I can assure you that no primates of any kind were harmed in its production.
A New Groovy Podcast
Since we had several Groovy people together in one place, we had to record a Groovy Podcast from the conference.
Left to right, that’s Zach Klein, Puneet Behl (ask him about his new espresso machine), me, and Paul King. I kept my hat on to keep from blinding the camera. You’re welcome.
(This edition is apparently not on the main Groovy Podcast homepage yet, but hopefully that will update soon.)
Cheating in Chess and Elsewhere
How about that Lizzie Borden, eh? As the nursery rhyme goes:
Lizzie Borden took an ax
And gave her mother forty whacks,
And when she saw what she had done,
She gave her father forty-one.
The count is off (according to this article, her stepmother was chopped 18 times and her father merely 11), but here’s the interesting part: did you know she was acquitted of all charges? The jury let her go, mostly because all the evidence was circumstantial.
The thing is, everybody knew she did it. Ask any lawyer and they’ll tell you acquitted doesn’t necessarily mean innocent. She may have been found not guilty, but in a way that was worse. Afterwards she was known as an axe murderer who got away with it, to the point where they made up nursery rhymes about her.
I remember this coming up during the first O.J. Simpson trial. He, too, was found not guilty, but he hardly escaped consequences, justified or not. He will always be treated like a murderer, and one that got away with it (at least to some degree). I think about this every time Donald Trump opens his mouth. His advancing age and rabid cult following may ultimately keep him out of jail, but even his fans know he’s guilty of a wide variety of crimes. For many of his supporters, that’s not even a bug — it’s a feature. His ability to escape consequences is part of the appeal (pun intended). It’s bound up in the power fantasy. I have no doubt, however, history will not be kind.
As Lt. Caffey said in A Few Good Men:
(Wow, Tom Cruise was young back then. That movie is from 1992, and Cruise was a baby-faced 30 year old at the time. Also, did you know his real name is Thomas Cruise Mapother IV? Like there were three generations of those already and they decided to keep the name going? Again, wow.)
That brings me to our latest bit of “evidence” provided during the ongoing chess cheating scandal involving Hans Niemann. This week, Chess.com, along with the Wall Street Journal, published their 72 page report about Niemann’s behavior on their site. The report claims that Niemann “has likely cheated in more than 100 online chess games, including several prize money events.”
That sounds like a lot. The report goes on and on. It says, however, that they can’t address any possible OTB (over the board) issues, though they identify situations that require further scrutiny. They also spend a lot of time talking about Nieman’s rapid rise and how it compares to other kids around his age, finding it remarkable but ultimately inconclusive.
In the end, for most people the report simply “validated their priors,” as they say in Bayesian statistics, meaning whatever you believed beforehand you still believed afterwards.
Several of the more balanced takes tried to keep an open mind. I listened to a chess podcast (specifically, the Perpetual Chess Podcast), and their conclusions were:
The ChessBase similarity tool I mentioned last week is at best a blunt instrument, and even its own documentation says it shouldn’t be used to detect cheating. It’s also easy to manipulate, and it isn’t consistent because it relies on whoever uploads their own computer analyses. Don’t rely on it in this case.
Niemann definitely lied about his online behavior, and that will have consequences.
There’s no actual evidence he cheated in any OTB games, including the game where he beat Magnus Carlsen at the Sinquefield Cup last month.
We should keep an open mind.
My reaction that last basically boiled down to: HA HA HA HA … HA (deep breath) HA HA HA … HA (cough, sputter) HA HA, and I repeat, HA. See the whole Lizzie Borden item above. The report makes it clear that cheating in online chess is far more pervasive than most people knew (approximately 20 to 25% of all titled players on the site have been caught at least once), and Niemann is now the face of that. I think they’re wrong about the distinction between online and OTB behavior — while he may never have cheated in person, I really don’t think anybody actually cares. Niemann will forever be considered a cheater, and his invitations and future career growth will suffer.
Another part of Niemann’s problem is that nobody seems to like him very much. He’s currently playing in the U.S. Championships, and his first round opponent had this to say after losing to him, as he is quoted in this article:
15-year-old Christopher Yoo said he felt “disrespected on every level” by Hans Niemann and channeled that anger to beat reigning US Champion Wesley So with the black pieces in Round 2.
Current U.S. champion GM Wesley So followed up with:
It might interest you to know that Wesley never says a bad word about anybody, so this is a big deal.
GM Fabiano Caruana (one of the 10 best players in the world) tweeted:
Of course, that mostly shows Fabi’s sense of humor. Fabi beat Niemann yesterday. Even so, it’s clear Niemann has very few defenders, and that’s a problem in the court of public opinion.
For what it’s worth, after four rounds Fabi is leading with 3.0, Sam Sevian is in second with 2.5, and Niemann is part of a group of eight players with 2.0. Clearly there’s a long way to go.
Just to show the cheating isn’t confined to chess (or poker, or fishing), we had a new scandal this week: An Irish Dancing Scandal Is the Latest in Our Season of Cheating. That article opens with:
Over in Ireland, 12 teachers are being investigated by the CLRG, and the Irish Independent claims to be privy to text messages implicating six more. One exchange reportedly revealed that a teacher and judge agreed to exchange sexual favors to raise scores ... Nonetheless, dancers as young as 10 and under have had their scores altered by these slip jig swindlers!
I’m not going to touch that one.
Other Tweets And More
Well, Duh
Apparently, Velma from Scooby-Doo is confirmed to be a lesbian. This led John Scalzi to tweet:
Hard to argue with that.
Guess! GUESS! (Mildly NSFW)
Long way to go for that gag, but totally worth it.
More Holiday Tweets
Other tweets (also by Glen Weldon) in the same thread:
Quoth the raven: “Take your meds.”
Quoth the raven: “Lenore’s dead, brah.”
Classic.
Another Entry in the Six-Word Story Competition
What could have happened??
A Bridge Too Far — NOT!
You probably already know, but just in case, here’s the NY Times article (free to share), Blast on Crimean Bridge Deals Blow to Russian War Effort in Ukraine.
Oh No
Yeah, I could easily see that happening.
Could Only Happen in Oz
Finally, for my Australian friends:
Have a great week, everybody. Please don’t cheat or pick fights with cows.
As a reminder, you can see all my upcoming training courses on the O’Reilly Learning Platform here and all the upcoming NFJS Virtual Workshops here.
Last week:
Three presentations at ApacheCon in New Orleans, LA
This week:
Week 1 of Spring and Spring Boot in 3 Weeks on the O’Reilly Learning Platform
Managing Your Manager, same.
Functional Programming in Java, also same.
. You covered a lot of different subject this week.
Enjoy the Big Easy? It's been many years since I attended a conference in NOL. I always enjoyed my trips to NOL.
BTW: Your quoted tweets did not come through very well.