Universal Windows Platform – Tutorial Insider – Lucky Roshambo

Standard

Overview

comentsys.wordpress.com today features a Universal Windows Platform tutorial showing how to create a Rock-Paper-Scissors game or Roshambo as it’s called in many parts of North America – the game logic for this is quite simple and is a good way of showing a game you’ve probably played in real-life at some point converted into a game you can play on the Computer.

Details

There’s some values that are used to encapsulate the main component of the game itself, there’s the three states win, draw and lose plus there’s what matches of each type of item – Rock, Paper or Scissors result in those states, these are the values and then there’s the options which are the Characters of the Segoe MDL2 Aseets Font represent each of those states. There’s a Random for a random number generator and then a method for displaying a dialog – ShowDialogAsync, this will also show which option was seleccted by the random number generator. When you Choose an option this will randomly select a response then you can see if you Win, have Lost or the result was a Draw, there’s GetShape which returns a Grid and TextBlock to display one of the options plus there’s an event handler used when useEvent is true to call the Choose method with the selected option and there’s the Layout method to display the options when New is called.

Behind the Scenes

Roshambo is a more unusual term for Rock-Paper-Scissors and came when researching what to call the tutorial – it also shares the same number of letters as Dominoes so has a good balance to the naming convention, something which appears quite a lot in the tutorials, plus is a simple game that most people have either played or heard of and can see how that translates to a Universal Windows Platform example or a chance to play it for the first time, with simple rules – Rock beats Paper, Paper beats Rock, Scissors Beats Paper, Rock Beats Scissors etc which may seem complex but all those rules are contained within this simple example.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s