Enea Xharja

Pig (dice game)

Pig Game project

The dice game Pig is considered a “jeopardy game”, where you risk all your points to see if you can win more. The numbers on the die, except for “1”, represent points that the player can accumulate.


Each turn, a player repeatedly rolls a die until either a “1” is rolled or the player decides to “hold”:

If the player rolls a “1”, he/she scores nothing and it becomes the next player’s turn. If the player rolls any other number, it is added to his/her turn total score and the player’s turn continues. If a player chooses to “hold”, his/her turn total score is added to the global score, and it becomes the next player’s turn. The first player to score 100 or more points wins.

Code available on GitHub.

Updated on February 09, 2018

Tagged with: projects

Profile picture

Hey there! I'm Enea, a web developer currently working at eqolot. Welcome to my little corner of the web, where I share my open collection of notes, code snippets, and resources on topics that interest me.

© 2021 Enea Xharja