After writing Staccato I thought I should play a little more with the Twitter API. Not that I had anything to particularly say about the API, or that I wanted to broadcast, but I wanted a framework that I could push into service at a moments notice in case I had an amusing idea.
I am currently about to write my third bot...
A simple (nay, stupid!) Twitter bot to post random suggests for names of projects. With its origins in the Boaty McBoatface saga (https://en.wikipedia.org/wiki/Royal_Research_Ship) this bot was created in July 2016 and ran for a year.
To be honest, there was never a very large dictionary, and the logic to compute the sentances was never smart enough, so its contents repeated itself too often. But it was handy to have since I ran it on my home server, so it was an ambient information source that told me there hadn't been a powercut or network outtage at home. (Although, I have other monitoring systems in place for that!)
The full source to Botty McBotface is available on github under the GPL!
Over the years I've tried to work Pi into as many projects, conversations, and environments as possible. I've attempted compositions, automatic literature, and quizzes using this most famous of transcendental numbers. But, PiBot is the one I'm writing about here.
What is it? In short, PiBot is an automatic Twitter bot which, every day, posts the next 140 characters of pi in sequence. That's it! Every day, another 140 characters. I used 140 because when I started, that was the upper character limit. Well, it's not exactly 140 since I wanted to include the #pi and #pitbot hashtags. Writing the code was a simple case of finding a text file with the first million digits of pi, and computing the number of days since launch.
When Twitter upped their limit to 280 characters I had the option of updating it. But didn't. Just because you have 280, doesn't mean you have to use them. And I didn't see the point.
I launched the bot on the 22nd July 2017. That's because the 22nd July is represented, in right-thinking countries, as 22/7. This is, approximately, pi. Twitter, being an ambient information source, meant the numbers would be ignored (and ignorable) on most days. It is, after all, of no practical value, but it's always amusing to see the numbers it tweets. Sometimes you (as a human) spot nice or interesting patterns. Sometimes these patterns raise questions. Like, when is the first occurrence of "31415926" in the number, after the start? When the first "0123456789" patterns, and so on.
So what did I find?
314159 first appears at 176,451st decimal place, with 31415 appearing slightly earlier at 88,008 – and either other places. No longer initial sequences were found.
012345 is even more elusive, appearing at both the 447855th decimal place and 814,212nd. For six ascending numbers, the mode of occurrences is two (for 012345, 234567, and 456789). Given there are just five such patterns, with the other two appearing zero and once, that's not statistically important, I'm sure. However Every pattern of six descending digits (i.e. 987654, 876543, 765432, 654321, and 543210) , exist only once in the first million digits of pi.
Spotting repeated patterns is easier, too, when you're idly scanning Twitter. The pattern 666666 just pops out of the screen (dp:252499) 55555 appears 13 times in total, across the first million digits. In fact, 5 is quite an egotist, with 555555 appear three times in total, more than any the sequence. (The only other 6-repeats to appear more than once are 777777 and 999999.)
I suppose I should now find the first 10 million decimal places and see if I can find some more interesting patterns!
The full source to Botty McBotface is available on github under the GPL!
Once upon a time, three geeks by the names of Andrew, Lee-Jon, and myself had a joke whereby we'd try and write tweets with as many jingo-istic buzzwords as possible, just to coax twitter bots into liking the post.
The joke got old pretty quickly, as #blockchain and #growthhacking would win every time. But, it kept my amused.
Fast forward to a few years later, and while the others had cleaned their hands of it I decided to write a Twitter bot of my own, to goad other twitter bots, into favourite'ing my posts! The idea was simple - tweet every word in the dictionary as a hashtag. A quick calculation revealed that it'd take over 11 years to complete to task! So, I changed the crontab to be hourly, instead of daily, and modified the code accordingly.
The full source to Botty McBotface is available on github under the GPL!