Get Similar Asssignment Answers & Custom Paper Writing Services

To hire a writer, fill the order form with details from your nursing assessment task brief.

Posted: April 20th, 2022

Rubik’s Cube Simulator

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

—-

Simulator for the Rubik’s Cube

You will be making a Rubik’s Cube simulator for this project.

Setup

Before you begin the lab, you must complete the following tasks:

1. Create a Rubik folder within your class folder. 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

Order | Check Discount

Tags: write my essay free, Write my thesis proposal, Write my thesis paper for me, Write my research paper proposal for me, Write my research paper free

Nursing Assignment Help For You!

Special Offer! Get 20-30% Off Your Order!

Why Seek Our Custom Writing Services

Every Student Wants Quality and That’s What We Deliver

Graduate Essay Writers

Only the most qualified writers are selected to be a part of our research and editorial team, with each possessing specialized knowledge in specific subjects and a background in academic writing.

Affordable Prices

Our prices strike the perfect balance between affordability and quality. We offer student-friendly rates that are competitive within the industry, without compromising on our high writing service standards.

100% Plagiarism-Free

No AI/chatgpt use. We write all our papers from scratch thus 0% similarity index. We scan every final draft before submitting it to a customer.

How it works

When you decide to place an order with Nursing Study Bay, here is what happens:

Fill the Order Form

You will complete our order form, filling in all of the fields and giving us as much guidelines - instruction details as possible.

Assignment of Writer

We assess your order and pair it with a skilled writer who possesses the specific qualifications for that subject. They then start the research/writing from scratch.

Order in Progress and Delivery

You and the assigned expert writer have direct communication throughout the process. Upon receiving the final draft, you can either approve it or request revisions.

Giving us Feedback (and other options)

We seek to understand your experience. You can also review testimonials from other clients, from where you can select your preferred professional writer to assist with your homework assignments.

For Similar Answers, Custom Essay Writing & Assignment Help Services

Find an expert by filling an order form for your nursing paper. We write AI-plagiarism free essays and case study analysis. Anytime!

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00