player1Turn() keeps saying that, regardless of what I put in, that temp = 0. temp is supposed to be which pit they chose, but numerically, so I could return temp and use it in the array. Also, I know there needs to be a return statement to complete the method, but for now I'm just trying to get temp to equal what I want it to. Suggestions for the whole thing are welcome, but I'm primarily concerned on player1Turn(). Thanks
import java.util.*;
public class Mancala
{
Scanner input = new Scanner(System.in);
public static void main(String[]args)
{
Mancala mancala = new Mancala();
int[] board = {0,3,3,3,3,3,3,0,3,3,3,3,3,3};
System.out.print(" ");
mancala.display(board);
System.out.print(" ");
mancala.player1Turn();
}
public static void display(int[] board)
{
System.out.println(" A B C D E F");
System.out.print(" ");
for(int i = 13; i >=8; i--)
{
System.out.print(" "+board[i]+" ");
}
System.out.println("\n"+board[0]+" "+board[7]);
System.out.print(" ");
for(int i = 6; i >=1; i--)
{
System.out.print(" "+board[i]+" ");
}
System.out.println("\n G H I J K L");
}
public void player1Turn()
{
int temp = 0;
System.out.print("Which pit would you like to select? ");
String pit = input.nextLine();
{
if(pit == "A")
temp = 13;
else if(pit == "B")
temp = 12;
else if(pit == "C")
temp = 11;
else if(pit == "D")
temp = 10;
else if(pit == "E")
temp = 9;
else if(pit == "F")
temp = 8;
else
System.out.print("That is not a valid pit!");
}
System.out.print(temp);
}
}