Die Rich Craps game in Java

For one of my programming projects last year, our task was to create a version of the Die Rich Craps game. I finally decided to put my code for that project (and others) on Github.

My submitted project looks, in retrospect, a little unreadable but I did try to comment the code appropriately. My Die Rich craps implementation is contains:

  1. 2 while loops
  2. 1 for loop
  3. 4 if/else statements
  4. 2 if statements
  5. 4 if-else-if laddered statements.

So, I am in the process of rewriting it to be a little shorter and slightly more testable. I have a rough & incomplete sketch which goes:

1) Create a Players class which will contain key variables that are unique to each instance of the Players class and a final static class variable which applies to all members of the Players class.

2) Create the DieRich class file (which includes the main method)

That’s as far as I’ve gotten. So far, it’s a good experiment to think about breaking the program/project into tasks and writing code accordingly.

I visited a software product company recently and I learned that tests (regression and unit tests) are exceedingly important & take up just as much time as coding does! The developer I ‘shadowed’ walked me through the process of unit testing which I will try to implement in my projects this semester.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s