Dominoes

Objective

For this assignment, you will demonstrate your skills and understanding of using PHP to create HTML to generate 100 random dominoes on the page.

Requirements

The following requirement must be met to complete the assignment successfully:

Warning

The web application must be functional and without errors. A non-functional game due to syntax errors or missing functionality will result in a failing grade.

  1. Clone this repository from GitHub and use the provided files to complete the assignment.
  2. Convert the index.html file to be a PHP file.
    1. Update the file extension
    2. Remove the demo HTML code
  3. Using loops and a simple array, generate the HTML necessary to create 100 dominoes.
    1. Each domino should have two sections.
    2. Randomly choose the number of dots to create using the rand() function.
    3. Add a number class to the domino section based on the number of dots created. The classes are: zero, one, two, three, four, five, and six.

Example

A completed version of the assignment can be found at the following:

https://mtm6405-dominoes.herokuapp.comopen in new window

Hints

The following hints can help complete the assignment.

  1. The following guide shows one way to complete the assignment Dominoes Template
  2. Unlike in JavaScript, nested loops must use different variable names for their iterators to avoid conflict with each other.
    // this will cause an infinite loop
    for ($i = 0; $i < 100; $i++) {
        for ($i = 0; $i < 10; $i++) {
            // output
        }
    }
    
    // instead do this
    for ($i = 0; $i < 100; $i++) {
        for ($j = 0; $j < 10; $j++) {
            // output
        }
    }
    

Rubric

CriteriaPts
Creates 100 dominoes on the page4
Creates two sections for each domino with the proper number class8
Creates a random number of dots for each section8
Total20