Rubik’s Cube Simulator In this project, you will be creating a Rubik’s Cube simulator.  Setup Before beginning the lab you will need to do the follo

  

Rubik's Cube Simulator

In this project, you will be creating a Rubik's Cube simulator. 

Setup

Before beginning the lab you will need to do the following things:

1. Create a folder within your class folder and name it Rubik. All of your files for this project must be saved in this CIS36A/Rubik directory.

2. Download the following files into your CIS36A/Rubik directory:

o RubikRunner.java Download RubikRunner.java

o RubikCube.java Download RubikCube.java

o RubikFace.java Download RubikFace.java 

3. Always compile and run RubikRunner.java class. It will automatically compile the other supporting classes. 

Submission

Submit all of your final source files

Submit sample console runs for all of the parts below. 

Part 1 – Create a Cube

You will be given the main program class (RubikRunner). You will not need to change RubikRunner.

You will also be given the skeleton to the Rubik's Cube class (RubikCube) and a placeholder class describing the face of a Rubik's Cube (RubikFace).  You will not have to change RubikFace.

Your assignment is to:

1) Implement the RubikCube constructor.  The constructor takes no arguments and creates and populates an array of RubikFace objects.  Each RubikFace should have its own color (ex: full color name: “White”).

2) Implement the toString() method of RubikCube.  The output of the method should be the net of the cube, with the front face in the center, as shown below.

Sample Run

    W
B O G
   Y
   R

 

Colors:

W: White

O: Orange

B: Blue

Y: Yellow

R: Red

You must use the faces array in your toString method to receive full credit.

Part 2 – Rotate the entire Cube

In this part, you will write code to rotate the cube.  You will need to implement a loop asking the user what direction to rotate in RubikRunner, and implement left(), right(), up() and down() methods in RubikCube that will rotate the cube in the given direction.  For example, if the cube looks like:

    W
B O G
   Y
   R

and you rotated left, the cube would now look like:

     W
O G R
    Y
    B

Your assignment is to:

1) RubikCube.java – Implement the 4 commands as void methods – left(), right(), up(), down()

2) RubikRunner.java – add a command loop that asks the user for which direction to turn the cube, including the option to exit the program.  After each turn is executed, print out the cube.

3) RubikFace.java – still nothing to do on this one, yet.

Sample Run

    W
B O G
   Y
  R
 

What direction? q to quit
What direction [right, left, up, down]: left
    W
O G R
   Y
   B
 

What direction? q to quit
What direction [right, left, up, down]: right
   W
B O G
   Y
   R
 

What direction? q to quit
What direction [right, left, up, down]: up
   O
B Y G
   R
   W
 

What direction? q to quit

 What direction [right, left, up, down]: down

   W
B O G
   Y
   R
 

What direction? q to quit
What direction [right, left, up, down]: q

 Part 3 – Nine-facet version of each face

In this part, you will be working mostly with the RubikFace class.  

Your assignment is to:

1) RubikFace – Add a 3×3 array to RubikFace that will hold the colors for each of the 9 facets on the face.  For now, set each of the facets to be the same color as the face.  You will also have to modify the toString method to return a 3×3 grid of colors.  If, for example, the color of the face was Red, your toString method should return:

 R R R
R R R
R R R

2) Update any methods in RubikRunner or RubikCube that require updating as a result of this change.

Starting with this activity, you need to comment on your code. 

Sample Run

       W W W
      W W W
      W W W
B B B O O O G G G
B B B O O O G G G
B B B O O O G G G
      Y Y Y
      Y Y Y
      Y Y Y
      R R R
      R R R
      R R R
 

What direction? q to quit
What direction [right, left, up, down]: left
      W W W
      W W W
      W W W
O O O G G G R R R
O O O G G G R R R
O O O G G G R R R
      Y Y Y
      Y Y Y
      Y Y Y
      B B B
      B B B
      B B B
 

What direction? q to quit
What direction [right, left, up, down]: up
      G G G
      G G G
      G G G
O O O Y Y Y R R R
O O O Y Y Y R R R
O O O Y Y Y R R R
      B B B
      B B B
      B B B
      W W W
      W W W
      W W W
 

What direction? q to quit
What direction [right, left, up, down]: down

      W W W
      W W W
      W W W
O O O G G G R R R
O O O G G G R R R
O O O G G G R R R
      Y Y Y
      Y Y Y
      Y Y Y
      B B B
      B B B
      B B B
 

What direction? q to quit
What direction [right, left, up, down]: right
      W W W
      W W W
      W W W
B B B O O O G G G
B B B O O O G G G
B B B O O O G G G
      Y Y Y
      Y Y Y
      Y Y Y
      R R R
      R R R
      R R R

 Part 4 – Shuffled Cube

In this part, you will write the first step of code to rotate one face of the Rubik's Cube.  When you rotate an actual Rubik's Cube, the front rows on the sides move with the face you're rotating – we're not doing that.  yet …

You will be working mostly with RubikFace in this exercise. 

Your assignment is to:

1) Modify the constructor for RubikFace. RubikFace will need to have randomly generated colors in each of the cells, except the center cell which will remain the color that is passed through to the constructor.

2) Modify RubikRunner to accept 2 new commands: cw (for clockwise) and ccw (for counter clockwise).  Each of those commands will call the corresponding new RubikCube methods that you will create.  Those new RubikCube methods (ccw() and cw()) will call the corresponding new methods in RubikFace. Note that the rotated face is always the front face (face 2).

The RubikFace methods will rotate the face 90 degrees in the indicated direction.

Note: if you did not get your faces to print out correctly in Part 3, substitute printing just the front face in your toString for RubikCube.

Sample Run

        G Y Y
      G W W
      Y O B
Y W R G Y R B W O
B B Y R O G G G G
R W B R B W G B R
      B O R
      O Y Y
      Y O R
      W W R
      B R B
      Y B O
 

What direction? q to quit
What direction [right, left, up, down]: cw
      G Y Y
      G W W
      Y O B
Y W R R R G B W O
B B Y B O Y G G G
R W B W G R G B R
      B O R
      O Y Y
      Y O R
      W W R
      B R B
      Y B O
 

What direction? q to quit
What direction [right, left, up, down]: cw  
      G Y Y
      G W W
      Y O B
Y W R W B R B W O
B B Y G O R G G G
R W B R Y G G B R
      B O R
      O Y Y
      Y O R
      W W R
      B R B
      Y B O
 

What direction? q to quit
What direction [right, left, up, down]: ccw
      G Y Y
      G W W
      Y O B
Y W R R R G B W O
B B Y B O Y G G G
R W B W G R G B R
      B O R
      O Y Y
      Y O R
      W W R
      B R B
      Y B O

Part 5

Finally – your simulator will be complete! This assignment will complete the ability to fully rotate your cube.

The basic methods you need for this are in place – the cw() and ccw() in RubikCube. You will need to modify cw() and ccw() in RubikCube to rotate the matching columns or rows of the top, left, right and bottom faces when the front face is rotated. You may need to create other methods in either RubikCube or RubikFace to support your efforts.

Sample Run

        Y G G
      G W B
      O B R
G Y Y B W W B W R
G B W R O R W G G
G B B G R O W G B
      G W W
      G Y B
      B G B
      O B O
      B R O
      W R G
 

What direction? q to quit
What direction [right, left, up, down]: cw
      Y G G
      G W B
      B W Y
G Y G G R B O W R
G B W R O W B G G
G B W O R W R G B
      W W B
      G Y B
      B G B
      O B O
      B R O
      W R G
 

What direction? q to quit
What direction [right, left, up, down]: ccw
      Y G G
      G W B
      O B R
G Y Y B W W B W R
G B W R O R W G G
G B B G R O W G B
      G W W
      G Y B
      B G B
      O B O
      B R O
      W R G

Get 20% Discount on This Paper
Pages (550 words)
Approximate price: -

Try it now!

Get 20% Discount on This Paper

We'll send you the first draft for approval by at
Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

Ace Writing Center has stood as the world’s leading custom essay writing services providers. Once you enter all the details in the order form under the place order button, the rest is up to us.

Essays

Essay Writing Services

At Ace Writing Center, Nowadays, students normally have extremely busy schedules. You will note that some of them have to take on some evening or weekend jobs in order to get some income that can help them to sustain in college or in the university. This can deny them a chance to write all the essays given. Others usually get bombarded with a lot of work by their lecturers. This can still delay such students from working on all their essays. However, some of them usually try to work on all these essays but end up delivering their work late. This can prevent them from graduating since most lecturers are strict on deadlines. If you want to write a business essay, the wise way is to hire an outstanding essay writing service like us, so that you can get the best results. If you are keen, you will note that many companies usually overcharge their customers. Some of them are there only to make money. And in reality, they really don’t care to build a long term commitment with students. You should not choose such companies. You should take your time and choose a reliable company to work with. Ace Writing Center is the ultimate solution for you. We have been offering our writing service for more than 7 years. This is a clear indication that you will get quality essay writing service. We have a wide range of writers who can work on any business essay that you might have. We believe in doing extensive research so that we can provide quality work to all our clients. .

Admissions

Admission and Business Papers

Have you ever had to write an admission essay for college? The majority of students face the same issues when applying to a university or college and many in such situations decide they need professional help to cope with this matter. They get in a situation when the deadline keeps coming closer but lack motivation to start because they are just not sure if their writing skills are strong enough. We have a solution for you! Ace Writing Center is the best admission essay writing service with a large professional team and years of experience in providing high-quality papers to students of all levels and faculties. The mission of our team is to help students make their dreams of entering a good college come true and that’s what we offer!.

Editing

Editing and Proofreading

Sometimes all the words for your paper just flow out of your mind and into your fingers. You type quickly at your keyboard and there they are, your beautiful words right there on the screen. But you have no idea how to polish it up. You may be wishing there was a paper writing service that offered this type of writing service. Look no more! Here at Ace Writing Center, we offer you an editing and proofreading option that you can't find anywhere else..

Coursework

College Essay Writing

In case you are familiar Ace Writing Center, you know the way to distinguish a better company from a cheap one exactly. First of all, poor service website does not have a sufficient support. We think support team is an essential part of success; it has to answer all clients’ questions and be a connecting link between clients and their writers. On our web-service you will get answers about anything you need and your writer will receive all your instructions, assignments and requirements exactly and swiftly. A writing service that we run has got a flexible pricing system that will save you from senseless wastes and many bonus systems that let you sparing money for something important for you.