April 2015
Beginner
320 pages
7h 43m
English
Traditional board games such as Ludo, Monopoly, and Snake & Ladders all have an element of chance. Success is sometimes based solely on luck and the roll of the dice. In this chapter, you’ll create a JavaScript module that mimics a six-sided die (the standard die that comes with most board games). You’ll reuse this module in later chapters to give random greetings to players who join the game.
In this chapter, I’ll walk you through creating your first reusable JavaScript module.
When you throw a six-sided die, there’s no way of knowing what the throw will be; it can be any number between 1 and 6, but it’s impossible to know ahead of time. The number thrown is said to be random. Computers can also provide random ...
Read now
Unlock full access