O'Reilly logo

Beginning Facebook Game Apps Development by Wayne Graham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Guess the Number Game

Because this is a book on writing games in HTML5 for Facebook, let's walk through an example that implements a simple game, reinforcing the techniques in this chapter. For this example, we build a High–Low game, where the computer chooses a random number and you try to guess what it is.

The first thing we need to do is to define the rules of the game, and the expectations. As this is just meant to show off some of the code I have discussed in this chapter, the first iteration of this game is pretty bare bones. However, there is a second iteration of the code base with a few more bells and whistles (e.g., interface enhancements) that make the game look a bit nicer in the source code for this book.

For this game of High–Low, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required