Saturday 31 May 2014

The Monty Hall Problem



I've made a simulation of the Monty Hall Problem! The problem is as follows:

  • There are 3 doors, 1 has a luxury good behind it, eg. fancy car, the other two have worthless things. The incentive is to guess the door which has the car behind it.
  • You select a door, another door that does not have the car behind it is opened
  • You are given the option to switch doors, or stick with your choice
According to the following video, if you stick with your original choice, that will provide a probability of 1/3 that the car was behind it, but if you switched to the only remaining door, there would be a probability of 2/3 that it would be behind that one.

I've made it so you can run multiple games and find out the percentage win rate. Through my own testing of the simulation, the theory saying that you should switch definitely has merit. If I was asked, I would definitely switch.



Code/Edit



Also comes with CSS hover animations~

Monday 26 May 2014

Clojure Bridge!

A few weeks ago I attended a workshop called Clojure Bridge aimed at ladies (11/16 females to males!). Clojure is a functional programming language.

We learnt about core Clojure libraries and attempted to implement a web server, unfortunately our web service had a demographic issue and it didn't work :< Basically the point was that Clojure is great and manipulating data.


https://github.com/ClojureBridge/curriculum


I've been getting a lot of Thoughtworks swag as of recent~

~ R A I N B O W ~* \(^ W ^)/


I submitted this for this Colour Your Week competition.



Two weeks later I got this! Aw yea~

Saturday 17 May 2014

Murrrrr~



The DURR is a bracelet that alerts you by vibrating every 5 minutes (see video for how this might be useful). It came out half a year or so ago very exclusively for $120. It sounded like a simple introductory electronics project so since then, I've been meaning to create my own.

~ Murr ~



The Durr has given quite a bit of transparency in terms of what hardware they used so I just purchased what they used:

  • Coin vibration motor
  • ATtiny85 (the brain)
  • CR2032 battery
The total cost was ~$12 and months of waiting for components to arrive.

I used the Arduino to program the ATtiny: instructions

Spaghetti~

Although I attempted to code it myself but I found that others had used assembly which allows it to be much more efficient. Code from here.

I'm super happy with the result. ^w^ My photography doesn't do it justice, particularly that 70's brown veroboard.

Tuesday 13 May 2014

Primes!


Sieve of Eratosthenes

Sieve of Eratosthenes is an algorithm that gets all prime numbers under a specified number. It's fast and super easy to understand. This is my implementation of it.

My code and demo here:
http://jsbin.com/kixer/3/edit

Thursday 8 May 2014

Lamb durr~

I'm having a jam (hoho) packed functional programming week~ I'm volunteering at Lambda Jam, a FP conference put on by YOW!, then Clojure Bridge at Thoughtworks!