, ,

This started (once upon a time…) as Stanford CS106A Assignment 5. But I was a lil’ bit annoyed that they didn’t give the source for the yahtzeelib.jar they provided, cause I wanted to tinker with the interface a bit…

So I did what any other bored, OCD geek would do, I ignored the instructions altogether and started from zero. 😛

A week later here’s the result:

Yahtzee Applet


  • yahtzeeMain.java (view | download) — This extends AppWindow. I split this code away from AppWindow.java so that the logic-handling code sits on it’s own class.
  • AppWindow.java (view | download) — This extends JApplet, here is where the UI elements get created. I initially created this using Eclipse Indigo’s GUI designer; Then went in and changed stuff, ie. replaced JLabels with my custom labels etc.
  • scoreLabel.java (view | download) — This class extends JLabel. It is used in the score cards.
  • Dice.java (view | download) — This class also extends JLabel, it makes the Dice.

(you can get the pics from the .jar)


  • The rolled dice currently always show up in the same location in the dice area, it would be nice if they could randomly appear in different places, or even animate a little. I could probably adapt some of the code from Breakout.java to do this…
  • Turn it into a proper multi-player game, with php on the server side doing the handling (dice rolling, score and other sanity checks).
  • Learn more about LayoutManagers and change the null layouts to something better perhaps, ie. the scorecards should probably not be using the null layout, either BoxLayout or GridLayout would be better. The dice area however makes sense as a null Layout.
  • If I wanna go one step further, use a pre-drawn (ie. Photoshop) score card AND rotate it a few degrees to give the window a bit of pizzazz!