Jimmy Neville

Home About Me Tutorials Workout Articles
Craps Dicegame - From The Terminal To The Browser

6/29/2019 - One of the first programs I wrote in my intro to C++ class was a craps dice game. You can see the source code for the game here, and the output looked like this:

output

The rules are simple: You start out with $500 and you make a bet. If you roll a 7 or 11 on the first roll, you win the amount you bet. If you roll a 2 or 12 on the first roll, you lose the amount you bet. If you roll any other number, that number becomes your "target," and you keep rolling until you either roll your target number again (win money) or roll a 7 (lose money). At this point, assuming you still have money, you are asked to bet again, and the process repeats itself until you quit or run out of money.

I've been spending a lot of time this summer learning web design, and while in the process of completing a udemy course on javascript, I got the idea to recreate my dice game as a web application. I tried to make the new version as close to the old version as I could. Some of the main things I practiced while making the app were: hiding/showing different elements at different times, using random variables to infuence images, and using good html naming conventions.

You can see the source code for the browser version here.

Click here to play the game.



Back to homepage