© Jeanine Meyer 2018
Jeanine MeyerThe Essential Guide to HTML5https://doi.org/10.1007/978-1-4842-4155-4_8

8. Rock, Paper, Scissors

Jeanine Meyer1 
(1)
Purchase, NY, USA
 
In this chapter, we cover
  • Playing against a computer

  • Creating graphics to serve as buttons

  • Arrays of arrays for game rules

  • The font-family property

  • Inherited style settings

  • Audio

Introduction

This chapter combines programming techniques with HTML5 JavaScript features to implement the familiar rock-paper-scissors game. In the schoolyard version of this game, each player uses hand symbols to indicate one of the three possibilities: rock, paper, or scissors. The terminology is that a player throws one of the three options. The game rules are stated this way:
  • Rock crushes scissors

  • Paper covers rock ...

Get The Essential Guide to HTML5: Using Games to Learn HTML5 and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.