© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
J. MeyerThe Essential Guide to HTML5https://doi.org/10.1007/978-1-4842-8722-4_5

5. The Memory (aka Concentration) Game

Jeanine Meyer1  
(1)
Purchase, NY, USA
 
In this chapter, we cover the following:
  • Drawing polygons

  • Placing text on the canvas

  • Programming techniques for representing information

  • Programming a pause

  • Calculating elapsed time

  • One method of shuffling a set of card objects

Introduction

This chapter demonstrates two versions of a card game known variously as memory or concentration. Cards appear face down, and the player turns over two at a time (by clicking them) in an attempt to find matched pairs. The program removes matches from the board but (virtually) ...

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.