Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

WRITE A VERSION OF THE DICE GAME QWIXX IN JAVA Qwixx You will write a version of

ID: 3709774 • Letter: W

Question

WRITE A VERSION OF THE DICE GAME QWIXX IN JAVA

Qwixx You will write a version of the dice game Qwixx In this game there are 6 dice, 2 white dice and 4 colour dice: red, yellow, green and blue and each player has a game board as shown below: 2|3|4|5 6171819|10|11|12|a 2 3 4 5 678 9 1011 12 6 12 11 1098765 4 3 2 a 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 413|2 Ergebils The goal of the game is to score as many points as possible. The more numbers you cross off the higher your score. There are 4 rows of numbers, each a different color, and two of them go from 2-12 whereas the other two go from 12-2. The main rule is that you have to start on the left and go to the right- and if you pass up a number, well you're out of luck. In other words, you can mark off a number only if it's to the right of all marked-off numbers in the same row. So, if you marked of say the 2, 3 and 6 on the red row, the next number you can mark is 7 (or higher). You cannot mark off 4 and 5 anymore. At the start of each new round: The dice are rolled.

Explanation / Answer

COPY CODE HERE :

public class Qwixx {
//some instance variables
//more code...

public void checkWhiteDice_Movement() {
for (int i = 0; i<MovingPlayers.length; i++) {

MovingPlayer joueur = new MovingPlayer(MovingPlayers[i]);

System.out.println(" " + MovingPlayers[i] + " it's your turn...");
System.out.print("Would you like to cross of a number? (yes/no): ");
String WhitecolorDiceTotal = yourKey.next();

if (WhitecolorDiceTotal.equalsIgnoreCase("yes") {
System.out.print("What colour would you like to cross out?: ");
char colour = yourKey.next(".").charAt(0);  

if (ValidatedMovement(null, null)) //my problem is here where I'm
//some code //not certain what to put as
//arguments based on what the
//MovingPlayer wants to do
}
else
//some code

//helper method that returns boolean
private boolean ValidatedMovement(MovingPlayer p, Movement m) {
boolean validOrNot = false;
if (m.getColour() == 'R') {
if (p.getLastCrossedOffR() < getWhiteDiceTotal() && (redLocked == false))
validOrNot = true;
else
validOrNot = false;
//repetitive code for other colours
}
}
}
  
  
  
Here is my MovingPlayer class:
  
public class MovingPlayer {
public String name;
//other instance variables

//default constructor
public MovingPlayer() {  
name = null; }

//constructor
public MovingPlayer(String MovingPlayerName) {
name = MovingPlayerName; }

//method that crosses out the number from the white dice
public void makeMovement(Movement m) {
if (m.getColour() == 'R') {
gameBoard[Movement.convertColourtoNum('R')][(m.getNumber()) - 2] = "X";
}
//repetitive code for other colours
}
}

Here is the Movement class:

public class Movement {
private char colour;
public int number;

//some get/set methods for the attributes

//constructor that takes two inputs, a colour and a number and sets the attributes accordingly
public Movement(char colour, int number) {
this.colour = colour;
this.number = number;
}
}