CS 1704 Summer II 2003 

Project 1:  Rubik's Cube


Purpose:

1.                  To verify that all students have the basic knowledge required to continue in cs1704, and
2.                  To introduce software develop testing principles.

Requirements:

For this project, I will require:

1.                  A 3-dimentional array to represent the cube,
2.                  A struct to represent each block of the cube,
3.                  An enum to represent the faces of the cube,
4.                  At least 1 switch statement,
5.                  At least 1 for loop,
6.                  At least 1 while loop,
7.                  At least 1 stringstream (example posted here),
8.                  You may not use classes, and
9.                  You may not use dynamic data.

In addition to the above requirements that you should already be familiar with, the following requirement will be taught the first week of class:

 10.              You must use at least 3 testing switches, named 1 2 and 3

The Project

You will be implementing a console, command line based Rubik’s Cube.  As stated in the requirements above, the cube will be represented in memory as a 3D array of structs.  Each struct will contain 6 members, right, left, top, bottom, face, and rear.  Each member of the struct can hold the value of red, white, green, blue, orange, yellow, or null.  These colors represent each side of a block that makes up the cube.  Null represents the fact that each block does not have six colored sides.  For example, the center block on a face only has one color.  The eight corners have three colored sides. Some sides of the blocks are facing in to the Rubik’s cube, and therefore have no color.

Additionally, you will implement six basic functions, one to “spin” the top row of the cube to the right, one to “spin” the bottom row of the cube to the left, one to “spin” the left row column up, one to “spin” the right row column down, one to “spin” the face counter-clockwise, and one to spin the rear panel clockwise.  Each rotation will only be ¼ of a turn.  You will have to change the values of the members of the structs to update the new cube.

In addition, you will provide a prompt for the user to type the following commands:

spin<whitespace><face><whitespace><direction><whitespace><numturns>

print<whitespace><face>

save<whitespace><filename>

load<whitespace><filename>

quit

Print Format

To print a face, either to the screen or to a file, print it as if you were looking at it, from left to right, top to bottom in the following format:

color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color

Where color is red, white, green, blue, orange, and yellow of course.

When printing or reading from a file, the format is similar (do not include the lines I drew at the top and bottom to represent the beginning and end of the file:

_______________________________________
Face:<whitespace>right
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color

Face:<whitespace>left
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color

Face:<whitespace>face
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color

Face:<whitespace>rear
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color

Face:<whitespace>top
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color

Face:<whitespace>bottom
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color
__________________________________

Standards:

As with all programming projects in this course, please see http://courses.cs.vt.edu/~cs1704/summer2003/standards.htm for a list of requirements that apply to all projects.  YOU WILL BE GRADED on these.  In addition, include the following pledge at the bottom of your file:

On my honor:

- I have not discussed the C++ language code in my program with anyone other than my instructor or the teaching assistants assigned to this course.

- I have not used C++ language code obtained from another student, or any other unauthorized source, either modified or unmodified.

- If any C++ language code or documentation used in my program was obtained from another source, such as a textbook or course notes, that has been clearly noted with a proper citation in the comments of my program.

- I have not designed this program in such a way as to defeat or interfere with the normal operation of the Curator System.
<Your Name>

Submission

Name your file <yourpid>.cpp before 12:00 midnight of Tuesday, July 8, 2003.  To receive credit, your assignment must be submitted before the time and date listed above. The curator can only accept a limited number of submissions per minute, so curator lag is not an excuse for submitting late. It is your responsibility to successfully submit your assignment via the curator, so plan to submit early.  A maximum of five submissions is allowed per student, so DO NOT USE THE CURATOR FOR TESTING!  Only the final submission will be graded, not your highest grade.

          Submit to:  http://www.cs.vt.edu/curator/