What is a perfect score in Yahtzee?

The dice game Yahtzee takes thirteen turns. Each turn involves rolling a set of five dice (with two possible rerolls, the player having the option to reroll only a subset of the dice), then marking one of thirteen boxes and scoring points according to whether the numbers on the dice meet the rules of the…


Programmatically grabbing a screenshot of the primary display

It’s sometimes difficult to explain to people what my job actually is. “I test Windows sound.” “Cool.  How does that work?” A product like Windows has a lot of components that interact with each other.  If everything works, the user doesn’t know that most of these components even exist; everything is invisible and seamless. Most testing…


Generating primes using the Sieve of Eratosthenes plus a few optimizations

When solving Project Euler problems I frequently need to iterate over prime numbers less than a given n. A Sieve of Eratosthenes method quickly and easily finds the small prime numbers; there are more complicated methods that find larger prime numbers, but with a couple of tweaks the Sieve of Eratosthenes can get quite high….


How to create a shortcut from the command line

Working on Windows, I install Windows a lot.  This means a lot of my customizations have to be re-applied every time I install.  To save myself some time I created a script which applies some of them. Last time I showed how to set the desktop wallpaper from a command-line app. This time, a script…


Command-line app to set the desktop wallpaper

Working on Windows, I find myself installing Windows a lot. I find that I like to change a lot of the settings that Windows offers to non-default values.  (That is, I’m picky.) I have a script which automates some of these things, which I add to now and again.  Some of the bits of the…