cancel
Showing results for 
Search instead for 
Did you mean: 

Fun with PowerApps: X and 0's

Introduction

 

This blog is part of my 'Fun with PowerApps' series. This blog focuses on playing X and 0's using an app built using PowerApps. The blog itself briefly talks about the key features of the app, however, the MSAPP file is attached which you can download, open it your own PowerApp and publish it. The app is self-contained, i.e. no data connections are required for this app to fully function.

 

Screens

 

This PowerApp contains two screens, Main Screen and Game Screen.

 

Capture.JPG

 

This app heavily utilizes the following functions

 

Global variables. A total of 24 global variables have been used. This helps to keep the app very dynamic i.e. the outcome of situation depends of the current value of the variable.

If to see if certain conditions are met before the action can be carried out

Set to add or update values of a variables

&& to combine up to three variables

Group to add similar buttons or images into one group.

 

Main Screen

 

Capture1.JPG

 

The key feature in this screen is the 'Start the game' button. Here is the formula used in the OnSelect function of the button. The RequiredVar is a variable which is used to force the end user to add values to the Player 1 and Player 2 field and also to select the X and 0. Note: || is used as an or function.

 

Capture3.JPG

 

Game Screen


This screen has a lot going on behind the scenes. Majority of the decision is made in the 9 square buttons you see below.

 

Capture4.JPG


Here is a partial screenshot of what the OnSelect function looks like for the top left corner button or title. As you can see, the formula is a combination of several If and Set functions. This combination is used to keep tract of when a X or 0 should be used. It is also keeping track of if a winning condition has been met. Finally, if a winning condition is met then it records who the winner is and add a value to the score. Note: the && is used to combine several variables together

 

Capture5.JPG

 

The refresh icon on the top right is used to similar restart the game, however, it does keep the score.

 

Capture6.JPG

 

You can tell which player's turn it is. If it is the X player's turn then the X icon's color turns green, if it is the 0 player's turn then the 0 icon turns green.

 

Picture7.png

 

The finish button will set all the values back to their original defaults. This is used to restart the game. It will also navigate you back to the main screen.

 

 

Capture8.JPG

 

Capture7.JPG

 

Video


This video demonstrates how the app works and briefly talks about the functions just described above

 


Conclusion


This X and 0's power app is part of the Fun with PowerApps series. The previous two are 'Build your own Solar System' and 'Circle of Dots'. This app demonstrates the PowerApps can not only be used as a business solution but also as a gaming or educational solution.

Meet Our Blog Authors