I cant figure out what to write for my switch statement on this assignment,
(25 spaced board game with 2 players, each taking turns rolling a die untill someone reaches 25)
my method parameters for the movePlayer method are sapposed to be which player, (player1 or player2), moves as well as how many spaces out of 6 (rolled on the die). i am also sapposed to check if a winner can be identified in case 1 and case 2.
i thought i was getting the hang of this but on this i'm at a total loss for ideas of how to do it,
anyone have suggestions?
public class GameBoard
{
public static final int BOARD_LENGTH = 25;
private int player1;
private int player2;
private int winner;
public GameBoard(int player1State, int player2State)
{
player1 = 0;
player2 = 0;
winner = 0;
player1 = player1State;
player2 = player2State;
}
int player1State;
int player2State;
public int getBoardLength()
{
return BOARD_LENGTH;
}
public int getPlayer1State()
{
return player1State;
}
public int getPlayer2State()
{
return player2State;
}
int getWinner()
{
return winner;
}
public void resetBoard(int player1State, int player2State, int winner)
{
player1State = 0;
player2State = 0;
winner = 0;
}
// This method moves the specified player along
// the game board a specified number of spaces.
public void movePlayer( int spacesMoved, int playerMoved)
{
int spacesMoved;
int playerMoved;
switch( playerMoved )
{
case 1:
// Your code goes here.
case 2:
// Your code goes here.
default:
System.out.println("Warning: Player " + //Fill this in//
+ " does not exist!");
}
}
}