Share your repls and programming experiences

← Back to all posts
YAHTZEE - classic dice game dating back 65 years, now on Replit!
MarbleLover6561 (2)

I completely based this version of YAHTZEE on the classic dice game we all know and love. The gameplay is the exact same, except you can play it anywhere, anytime!

All you need is a Web browser and an Internet connection (just to load the page). If you got those, you're all set!

Those who are new to YAHTZEE, allow me to teach you the basics.


You have a scorecard with thirteen unique combinations, split into two sections: an Upper Section and a Lower Section.

Here's how you score in the Upper Section:

ACES - Score Aces only. Any die with the number 1 on it is considered an Ace.
TWOS - Score Twos only. Any die with the number 2 on it is considered a Two. Count how many Twos you have, and multiply that number by 2.
THREES - Score Threes only.
FOURS - Score Fours only.
FIVES - Score Fives only.
SIXES - Score Sixes only.


Calculating Your Upper Total

Once you fill up the Upper Section, it's time to calculate your Upper Subtotal. Add up your scores from the Upper Section!

If you scored a total of 63 points or more in the Upper Section, give yourself a pat on the back and a 35 point bonus!

PRO TIP: For optimal chances of getting the Upper Bonus, try to score at least 3 in Aces, 6 in Twos, 9 in Threes, etc. I usually strive to score 24 in Sixes to increase my chances of getting the Upper Bonus even further!

Here's how you score in the Lower Section:

TRIPLET - Rolled a three of a kind? Add up the total score from all 5 dice and score here.
QUADRUPLET - Rolled a four of a kind? Add up the total score from all 5 dice and score here.
FULL HOUSE - Rolled a Triplet and a pair?* Score 25 points here.
S STRAIGHT - Rolled a sequence of four consecutive numbers? Score 30 points here.
L STRAIGHT - Rolled a sequence of five consecutive numbers? Score 40 points here.
CHANCE - Add up the total score from all 5 dice and score here. No prerequisites, no gimmicks, none of that. This is essentially a freebie.
YAHTZEE - The hardest and most powerful combo! Rolled a five of a kind? Score 50 points here!

*A pair is two of the same number.


LOWER BONUS

Got lucky enough to roll another YAHTZEE, but you've already scored in YAHTZEE? Don't fret - actually, you should be proud! All you need to do now is follow these simple instructions and you'll receive a massive 100 point bonus per extra YAHTZEE!

If the corresponding box in the Upper Section is open (e.g. you rolled 4-4-4-4-4 and Fours is open), score there. Otherwise, score any Lower Section combo that is still open. (Example: if you rolled 5-5-5-5-5 and you've already scored Fives, and you have L Straight open, you can score 40 in Large Straight.)


MAXIMUM POSSIBLE SCORE

The maximum possible score is 1,575. This is only achievable if you roll a YAHTZEE on every turn and score the highest possible in every box. This comes out to the following:

  • 5 in Aces
  • 10 in Twos
  • 15 in Threes
  • 20 in Fours
  • 25 in Fives
  • 30 in Sixes
  • 30 in Triplet
  • 30 in Quadruplet
  • 25 in Full House
  • 30 in S Straight
  • 40 in L Straight
  • 30 in Chance
  • 50 in YAHTZEE
  • +1,235 in bonuses

As of yet, no one has gotten lucky enough to score 1,575 points in one game of YAHTZEE.

My highest score ever in one game of YAHTZEE was 823. My challenge to you: try to beat that score.


Also, this version of YAHTZEE is 100% keyboard-compatible!

Press Space to roll all unheld dice.
Press T to open the "How to Play" menu.
Press C to open the Changelog. Here you can find update notes dating all the way back to v1.0, when this game was first released on Replit!
Press / to open the Keyboard Shortcuts menu.
Press the number keys 1 through 5 to hold that respective die. This will prevent it from being re-rolled on the next roll, which can really come in handy.
Press N to start a new game. You will be asked to confirm that you want to start a new game. Upon confirmation, the previous game will be stored under Previous Games and in your browser storage.
Press P to place your score in the selected combination from the dropdown menu.
Press Q to perform a hard reset and refresh the page. (Beware: this will clear your game history!)
Press R to reload the page. (Beware: you will lose your progress on the current game, but your game history will be saved.)
Press G to view results from previous games.
Press H to hold all 5 dice.
Press U to unhold all 5 dice.
Press I to invert your selection of held dice.


Every line of code for this project was solely written by me. I gotta say, I'm pretty proud of how it has turned out so far.

Let me know down below in the comments how you like this project or what you would like to see added in the future! This project is still a work in progress, so I am definitely open to suggestions.

NEW in Version 1.7:

I have added an Apple touch icon for iOS and macOS users. Happy rolling!

Update v1.7.1 on May 1, 2021:

I finally figured out how to center <table> elements on the page using CSS. I applied this rule to all tables so that it looks nicer. If you want to know how I did it, all you need to do is add the following lines to your CSS file:

table {
    margin-left: auto;
    margin-right: auto;
}
Comments
hotnewtop
MarbleLover6561 (2)

@Squirrel2019 By the way, like I said above, I am open to suggestions. Is there anything you want to suggest that I add?

Squirrel2019 (1)

@MarbleLover6561 nothing that i can think of right now.

MarbleLover6561 (2)

For those who are wondering what an "Apple touch icon" is, it's the icon that can be found on many bookmarked pages on the "New Tab" page in Apple Safari for iOS and macOS.