Canvas Apps Code Sample

Have you played Yahtzee? In Power Apps!

Yahtzee App home screen
Yahtzee game

What is Yahtzee?

Yahtzee is a dice game where the objective of the game is to score points by rolling five dice to make certain combinations. The dice can be rolled up to three times in a turn to try to make various scoring combinations and dice must remain in the box. A game consists of thirteen rounds. After each round, the player chooses which scoring category is to be used for that round. Once a category has been used in the game, it cannot be used again. The scoring categories have varying point values, some of which are fixed values and others for which the score depends on the value of the dice. A Yahtzee is five-of-a-kind and scores 50 points, the highest of any category. The winner is the player who scores the most points.

Why I wanted to make Yahtzee in Power Apps?

I have always had a fascination to rebuild apps that I use everyday, or games that I play everyday, using Power Apps. Why? I am not sure. It's may be it is the fascination to stretch the platform to its limits in trying to implement complex logic. Or may be it is because I like to prove that just because it is a low-code platform, that it isn't a joke.

Yahtzee game building approach

I had a very well laid out approach when building out my last game, Battleship. And, this time too, I was able to start with a nicely documented approach. That being said, they were not necessarily in the sequence of how these will be used/needed in the gameplay.

  1. Ability to roll a die
  2. Then the ability to roll multiple dice
  3. After that, the ability to select which dice to not change/roll
  4. Then the ability to identify patterns/combinations for a given dice roll
  5. And finally the ability to select patterns/combinations and mark them as complete

Yahtzee game logic approach

Most of the logic needed to meet the above requirements wasn't complex but bringing it all together was definitely fun. Also, focusing on the UX to keep the game simple but exciting was also a nice challenge.

Conclusion

I had a lot of fun recreating Yahtzee in Power Apps. The idea here is to share how I laid out the requirements and then went about building out the app. Hopefully, this will inspire you to build something fun and fancy with Power Apps!

Yahtzee code

I have uploaded the ZIP and MSAPP files of my Battleship app here: Yahtzee code.

To learn how to import an app file, click here.

Recent articles

  1. Everything you need to know about modern controls
  2. How to use custom sorting in canvas apps
  3. How to use Dataverse views to filter related records

2 thoughts on “Have you played Yahtzee? In Power Apps!”

Leave a Reply