1. To verify that all students have the basic knowledge required to continue in cs1704, and
2. To introduce software develop testing principles.
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
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
rowcolumn up, one to “spin” the rightrowcolumn 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>
- Where face is “right, left, face, rear, top, or bottom”
- Where direction is either + or –
- Note, a minus direction indicates that you will have to reverse the direction of the spin without creating new functions. This is accomplished by understanding that for example, one turn to the left is equal to 3 turns to the right.
- Where numturns is the number of times I want to repeat the spin
print<whitespace><face>
- Where face is “right, left, face, rear, top, or bottom” (see format below)
- This prints to the screen, not a file
save<whitespace><filename>
- Where the state of the board is written to a file named filename (see format below)
load<whitespace><filename>
- Where the state of the board is read from a file named filename (see format below)
quit
- exits your program without saving
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>colorWhere 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>colorFace:<whitespace>left
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>colorFace:<whitespace>face
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>colorFace:<whitespace>rear
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>colorFace:<whitespace>top
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>colorFace:<whitespace>bottom
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color
color<whitespace>color<whitespace>color
__________________________________
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>
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/