Java port for Happy or Sad project (would be a bit more extended)