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.
- Clone this repository from GitHub and use the provided files to complete the assignment.
- Convert the index.html file to be a PHP file.
- Update the file extension
- Remove the demo HTML code
- Using loops and a simple array, generate the HTML necessary to create 100 dominoes.
- Each domino should have two sections.
- Randomly choose the number of dots to create using the
rand()
function. - Add a number class to the domino section based on the number of dots created. The classes are:
zero
,one
,two
,three
,four
,five
, andsix
.
Example
A completed version of the assignment can be found at the following:
https://mtm6405-dominoes.herokuapp.com
Hints
The following hints can help complete the assignment.
- The following guide shows one way to complete the assignment
- 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
Criteria | Pts |
---|---|
Creates 100 dominoes on the page | 4 |
Creates two sections for each domino with the proper number class | 8 |
Creates a random number of dots for each section | 8 |
Total | 20 |