Expected Value Calculator for Lotto Max and Lotto 6/49

Discover how you throw away nearly half of whatever disposable income you put towards playing the lottery. You may be surprised how much you lose on average when you dream of winning big!

*     *     *

December 2024 comment from author: I haven’t updated this in a while. There are now different ways to win for Lotto 6/49. Lotto Max increased their ma… Read more

Rapidly Computing the Standard Deviation for a Fixed Period (Length of Data)

Wikipedia’s page for Standard Deviation presents a formula for rapidly calculating the standard deviation of a growing set of numbers:

[1] Qk = Qk-1 + (xk – Ak-1)(xk – Ak) where xk is the kth element in the set and Ak is the mean of the first kth numbers.

The standard deviation squared of the first n numbers of a set is Qn / n.

From this, it is easy … Read more

List of MSN Gaming Zone Backgammon Cheaters

[Update: MSN has removed Backgammon from its games. Probably because of the rampant cheating. For a more fair place to play Backgammon that minimizes the chance of cheating (particularly because of the availability of instant replays) try https://www.gameslush.com/backgammon]

Figured I’d compile this list after seeing several cheaters that … Read more

PHP’s setcookie() with $expire set but not $domain will blow away the cookie in Internet Explorer (IE)

Spent a whole day figuring out this one.  Yet another reason why Internet Explorer is the bane of web development. Found a plethora of suggested solutions on the net, and even an old bug logged for PHP in 2001, but the reason behind the bug is still a mystery.

As the title states, if you use setcookie() with $expire set and $domain not set, then IE may simply let th… Read more

An efficient but effective artificial intelligence for Big 2

(tl;dr: You can play against an AI computer user I designed for an online Big 2 game here.  The bots are capable of calulcating the expectation for its score for every possible line of play very quickly, resulting in a rather worthy opponent for even the most seasoned Big 2 players).

The dynamics in Big 2 make programming AI for it an interesting problem.  The … Read more

Using the background function of Processing.js with images

“Background image must be the same dimensions as the canvas.”

In case you are looking for a workaround for Processing.js background function that forces you to scale your background image, try this trick to make your browser do the scaling for you.

Set the CSS background for the canvas element to your image, and use “cover” or R… Read more

Fonts in Processing.js

Since the documentation at http://processing.js is still tailored for processing code, I’ll post an example of how to port font usage to JS (assuming you have an “inArray” function like jQuery’s).  It shows how you can store all the fonts you need in an associative array for easy reference afterward:

var fonts = {};

processing.
Read more

CSS: Two columns equal height, one fixed, the other fluid width

To save others the time and hassle, here’s my lesson learned: don’t try it.  No matter how close you can get with CSS, after almost a day of searching and experimentation, I eventually fell back to this:

http://giveupandusetables.com/

Why?  At some point in time I had the basics working (in all browsers!), but then I tried to add another div ce… Read more

Mercurial: “hg push” over ssh, remote says “permission denied”

I spent a decent amount of time figuring out this vague error message, so perhaps this post can save someone else some hassle.  I found that many people encountered this problem, posted it on some online forum, but no one gave a clear answer.  So here is one possible solution:

Suppose you set up a remote Mercurial repository, cloned it locally via SSH to your m… Read more