Due: Friday, Feb 24th by 11:59 PM

Getting Started

Start by downloading CS101_Assign03a.zip, saving it in the directory H:\CS101.

Falling Dominos

In this assignment, you will begin writing a program to simulate falling dominos.

In this milestone, you will allow the user to determine the initial configuration of the "playing field" consisting of 10 positions. Once the configuration has been entered by the user, the program should print a line of text which is a "picture" of the configuration.

Here is an example run (user input in bold):

Enter the initial configuration:
Position 1 (0=empty, 1=upright, 2=tipping, 3=horizontal): 1
Position 2 (0=empty, 1=upright, 2=tipping, 3=horizontal): 1
Position 3 (0=empty, 1=upright, 2=tipping, 3=horizontal): 0
Position 4 (0=empty, 1=upright, 2=tipping, 3=horizontal): 1
Position 5 (0=empty, 1=upright, 2=tipping, 3=horizontal): 2
Position 6 (0=empty, 1=upright, 2=tipping, 3=horizontal): 3
Position 7 (0=empty, 1=upright, 2=tipping, 3=horizontal): 0
Position 8 (0=empty, 1=upright, 2=tipping, 3=horizontal): 1
Position 9 (0=empty, 1=upright, 2=tipping, 3=horizontal): 2
Position 10 (0=empty, 1=upright, 2=tipping, 3=horizontal): 1

Initial configuration:
|| |/_ |/|

When printing out the state of the playing field, each upright domino should be represented by a "|" character, each tipping domino by "/", each horizontal domino by "_", and each empty position by a blank space.

Hints

Use an array of integer values to represent the playing field. The element at position 0 is position 1, the element at index 1 is position 2, etc. The value of each element determines what is at that position: 0 for an empty space, 1 for an upright domino, 2 for a tipping domino, 3 for a horizontal domino.

Each iteration of the loop that prints the playing field should print a character representing one position. Print "|" if the position has an upright domino, "/" if the position has a tipping domino, etc.

Grading

Out of 50 points:

  • Declaration of an array to represent the playing field: 10
  • Loop to read a value for each position of the playing field: 10
  • Store each position value in the appropriate array element: 15
  • Loop to print a "picture" (line of text) of the playing field: 15

Submitting

To submit your work, make sure your FallingDominos.cpp file is saved, and in the Cygwin window type the command

make submit

Enter your Marmoset username and password (which you should have received by email.) Note that your password will not be echoed to the screen. Make sure that after you enter your username and password, you see a message indicating that the submission was successful.

Important: Make sure that you check the file(s) you submitted to ensure that they are correct. Log into the server using the following URL (also linked off the course homepage):

https://cs.ycp.edu/marmoset/

You should see a list of labs and assignments. In the row for assign03a, click the link labeled view. You will see a list of your submissions. Download the most recent one (which should be listed first). Verify that it contains the correct files.

You are responsible for making sure that your submission contains the correct file(s).