Posts

The only number whose Scrabble score equals itself is TWELVE

When Heather and I were playing Scrabble recently, one of us played TWELVE and were amused to observe that it scored 12 (it wasn't played on any premium squares). Scoring other numbers in our heads (ONE, TWO, THREE, etc.) we couldn't find any others that worked like this, and so we wondered if it was the only such number. I started by writing a script which generated the written form of a number (1=ONE, 2=TWO, 666=SIX HUNDRED AND SIXTY SIX) and then added a function which calculated the Scrabble score for the word(s) . I ignored spaces and didn't consider premium squares or the maximum size of a scrabble board. I then used these to test the first few hundred thousand numbers, and found that the only match was TWELVE. I also found that the highest scoring number with n digits was the number made up purely of 6s. So 6 is the highest scoring 1 digit number, 66 is the highest scoring 2 digit number, etc. There were other numbers that scored as much (e.g. 65 scores as much

Javascript function to convert a number into the English written format (1=ONE, 2=TWO, etc.)

This takes any positive integer number (up to 10^66-1) and returns the English written format (in upper case) for that number. So 1 -> ONE, 666 -> SIX HUNDRED AND SIXTY SIX. f unction inWords(num) {   var a = ["","ONE","TWO","THREE","FOUR","FIVE","SIX","SEVEN","EIGHT","NINE","TEN","ELEVEN","TWELVE","THIRTEEN","FOURTEEN","FIFTEEN","SIXTEEN","SEVENTEEN","EIGHTEEN","NINETEEN "];   var b = ["","","TWENTY","THIRTY","FORTY","FIFTY","SIXTY","SEVENTY","EIGHTY","NINETY"];   var c = ["THOUSAND","MILLION","BILLION","TRILLION","QUADRILLION","QUINTILLION","SEXTILLION","SEPTILLION","OCTILLION","NONILL

Javascript function to calculate the Scrabble score for a word

This takes any string of characters and totals up how much it would be worth in Scrabble. It ignores any spaces or other non alphabet characters. It doesn't factor in any premium letter or word squares, and it doesn't care if you provide more letters than could possibly fit on a real Scrabble board. function scrabbleScore(word) {   var scores = [1,3,3,2,1,4,2,4,1,8,5,1,3,1,1,3,10,1,1,1,1,4,4,8,4,10];   var score = 0;   word = word.toUpperCase();   for (var i=0; i<word.length; i++) {     var n = word.charCodeAt(i) - 65;     if (n<0 || n>25) continue;     score += scores[n];   }   return score; }

How to count how many photos you have in Google Photos

Image
I'm in the process of copying all my photos from over the years to Google Photos. They currently reside in Apple Photos, which reports exactly how many photos I have. But this seems to be a feature missing from Google Photos. I'm using the Google Photos Backup utility to upload all the photos, and it reports a count. But to be extra confident I'd like to see a count of how many are actually in Google Photos now. This article is about how I was able to get a count of photos from Google Photos.

How to draw a travel time boundary on Google Maps

Image
If you have a specific destination in mind, then Google Maps is perfect for estimating how long it will take to get there, by various modes of travel. But if you just want to know how far you could travel from a given address in an hour, then it isn't much help. Perhaps you're visiting somewhere new and just want to see what you could walk to within an hour of your hotel. Or you want to make a day trip somewhere and want to see where you could drive in a couple of hours.

Handheld Vibrating Timer Prototype using Trinket

Image
There are times while exercising when it would be useful to have a simple one-button hand-held 30-second timer that vibrates. At least that's what my wife tells me. This seemed like a good excuse to play with Adafruit's mini microcontroller called "Trinket". These are an $8 tiny board built around the Atmel ATtiny85. The idea of the device is simple. You press the button, and it vibrates quickly to notify you that it is armed. Then after 30 seconds it vibrates again to say the time is up. I might modify it later so that two quick pushes sets a 60 second timer, but I'm starting simple.

How to make a $30 internet connected door alarm

Image
We run a vacation rental and have always wanted a simple way of knowing when our guests have checked-in. Some owners have a security system or electronic door lock that notifies them. But these often come with a subscription fee and seemed overkill for our purposes. What I'll describe in this post is how we built a simple device that sends us an email each time the front door is opened or closed. We then use gmail filters to file these emails away most of the time. When we are waiting for a check-in we adjust the filters to bring our attention to it using the LED gmail notifier that I posted about previously.