Rubik’s Cube Simulator In this project, you will be creating

  

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

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

After attending the event (hypothetical, linked below), write a 1

After attending the event (hypothetical, linked below), write a 1 page reflection paper that contains the following: Name of event and event Details – linked below Why the event is/was significant to you or your professional development? How attending the event contributes to your professional development, through self-improvement planning, relationship-building,

Instructions This week (week 6) you will be completing your

Instructions This week (week 6) you will be completing your outline for your research project which is due by the end of Week 7.  This weeks assignment is a one-pa ge outline for your week 7 project.  You will use proper outline formatting and address key points for your project. 

Various models of culture care are available to support the

  Various models of culture care are available to support the delivery of quality care in nursing. Theorists such as Campinha-Bacote, Giger and Davidhizar, Leininger, Purnell, and Spector have developed models that nurses use as they incorporate a patient’s culture into the nursing care they provide. Explain what model of

You will be required to interview a business manager of

You will be required to interview a business manager of a major corporation operating in the LA area. Let the interviewee know that you are taking a class related to Business Responsibilities in Society and that you are required to interview a business manager to find out some of the

Factors For Pilicy Considerations

 For this discussion, you will be evaluating the decision making process of prosecutors in relation to the prosecution of female sex offenders. Specifically, you will be evaluating factors that impact the prosecutorial decision making process and the subsequent influence on policy. Based on what you have learned in this module,

What are some common examples of momentum conservation in your

What are some common examples of momentum conservation in your daily life? Explain how you can apply the law of conservation of momentum to one of these examples. Please include the name of the person or question to which you are replying in the subject line. For example, “Tom’s response

RESC 417 PSMC Respiratory Care Questions Nursing Assignment Help

Expert Solution Preview Introduction: As a medical professor responsible for creating college assignments and evaluating student performance, it is important to approach each content with expertise and provide accurate and insightful answers. In this particular case, the content is not mentioned, so let’s provide an answer based on a common

Explain the modifiable and nonmodifiable risk factors for osteoporosis. How can a nurse support the patient to manage the health condition and restore the patient to optimal health? CLC – Evidence-Bas Nursing Assignment Help

Explain the modifiable and nonmodifiable risk factors for osteoporosis. How can a nurse support the patient to manage the health condition and restore the patient to optimal health? CLC – Evidence-Based Practice Project: Intervention Presentation on Diabetes Part 2 Upcoming Assessment Traits Group Requires Lopeswrite Assessment Description This is a

Assessment Description Students who qualify for an Individualized Education Plan

Assessment Description Students who qualify for an Individualized Education Plan (IEP) have a legal right to the least restrictive environment (LRE) as included in IDEA. Teachers can better meet the needs of their ELLs and bilingual/dual language students with exceptionalities by understanding federal legislation protecting the rights of students with

Combine the presentation you developed from Phase 3 and Phase

Combine the presentation you developed from Phase 3 and Phase 4 into a single team development presentation. Using all of your materials from phase 3 and 4 (assignments), review all of the comments and recommendations provided from your instructor and peers to help you finalize your presentation. Include all of

Go to one of the following online collections, and select

Go to one of the following online collections, and select an example of a Vanitas Still Life: The Metropolitan Museum of Art The National Gallery of Art The Tate Museum The Walters Art Museum The Rijks Museum Closely examine your Vanitas Still Life selection, and identify at least three objects within

This assignment has five parts: (a) Components of Research,(b) Sources

This assignment has five parts: (a) Components of Research,(b) Sources of Information, (c) Use and Misuse of information, (d) Established Tools of Measurement, and (e) Types of Research. Components of  Research: Identify the major components of the scientific method and relate them to writing a research report. Then briefly discuss

Get list of FTSE 350 companies from the London Stock Exchange website

Premium Paper Help is a professional writing service that provides original papers. Our products include academic papers of varying complexity and other personalized services, along with research materials for assistance purposes only. All the materials from our website should be used with proper references.

Use a Web search engine to search for local, state,

 Use a Web search engine to search for local, state, and federal government agencies that deal with cybersecurity. You will select one agency to write about. A list of suggestions is provided below. Select from criminal justice organizations and agencies, such as: One in the city, town, or state where

Create a toolkit that can be used in your business

  Create a toolkit that can be used in your business and educational experiences in the future.  What key points should be noted as “need to know.” An example is understanding the interviewing process. A toolkit is created to serve as a repository for HR documentation that can be used

This is the third of three milestone assignments that will

This is the third of three milestone assignments that will lead to completion of your course project. In this assignment, you will complete Critical Element IV: Adjusting Entries and Critical Element VI: Communication. This milestone addresses the following course outcomes:  A. Differentiate between the Generally Accepted Accounting Principles and the

Agamemnon question: Imagine that you are a brand new lawyer,

Agamemnon question: Imagine that you are a brand new lawyer, who is responsible for defending Clytemnestra when she is put on trial for her actions. Make sure to refer to specifics from the play as you explain your case for her defense and consider the motivating factors in her quest

UAGC Breast Cancer Case Study Nursing Assignment Help

The case study presented in Chapter 8 highlights how different cultures view disease, prevention, and treatment. As health professionals, we must be cognizant of these beliefs if we wish to make meaningful positive changes. In your paper, Compare and contrast the different cultures highlighted in the case study. For example,