[Java] help with text Mancala game

import java.util.*;
import java.util.Scanner.*;
public class Mancala {
  public static void main(String[] args){
    System.out.print("Welcom to a simple game of Mancala\n\n Two players will take turns picking from one of \n the six 'holes' on their side. The stones picked up\n will be deposited in subsequent holes progressing\n counter-clockwise around the board. if a stone\n is placed in your store, it stays there. The\n game contimues until there are no more stones on\n one side of the board. The winner is the player\n with the most stones in their store.\n\n" );
    System.out.print("A couple of special rules to remember.\n -Stones are only placed in the player's store\n  not the opponnents store.\n -If the last stone is deposited in the store\n  for a player, the player gets a gree turn.\n -if the last stone goes in a empty hole\n  on a player's side, the player captures all\n  of the pieces that are in the apponet's\n  hole on the oposite side <if any>.\n -Any pieces left on a player's side at\n  the end of the game go into that player's store.\nHit enter when ready to play\n");
    System.out.print("----------------------------------------------------\n");
    int player= 0;
    int temp =0;
    int i=0;
    int p1s =0;
    int p2s =0;
    int TH1=4,TH2=4,TH3=4,TH4=4,TH5=4,TH6=4;
    int BH1=4,BH2=4,BH3=4,BH4=4,BH5=4,BH6=4;


while(i==0){
System.out.print("----------------------------------------------------\n");
System.out.println("Player 2 Store:"+ p1s);
System.out.println("\t\t"+TH6+" " + TH5+" " + TH4+" " + TH3+" " + TH2+" " + TH1+"  Holes 6-1");
System.out.println("\t\t"+BH1+" "+BH2+" "+BH3+" "+BH4+" "+BH5+" "+BH6+"  Holes 1-6");
System.out.println("\t\t\t\t Player 1 Store:" +p2s);
System.out.println("Player 1, from which hole do you want to pick up the stones?");
Scanner sc = new Scanner(System.in);
player = sc.nextInt();
if( player<=0 || player >=7){
  System.out.println("Bad number, try again.\nHoles are numbered 1-6");
}else if (player==1){
  temp=BH1;
  BH1=0;
  i++;
}else if(player==2){
  temp= BH2;
  BH2=0;
  i++;
}else if(player==3){
  temp= BH3;
  BH3=0;
  i++;
}else if(player==4){
  temp=BH4;
  BH4=0;
  i++;
}else if(player==5){
  temp=BH5;
  BH5=0;
  i++;
}else if(player==6){
  temp=BH6;
  BH6=0;
  i++;}

}
System.out.print("----------------------------------------------------\n");
System.out.println("Player 2 Store:"+ p1s);
System.out.println("\t\t"+TH6+" " + TH5+" " + TH4+" " + TH3+" " + TH2+" " + TH1+"  Holes 6-1");
System.out.println("\t\t"+BH1+" "+BH2+" "+BH3+" "+BH4+" "+BH5+" "+BH6+"  Holes 1-6");
System.out.println("\t\t\t\t Player 1 Store:" +p2s);
System.out.println("playeyr =" +player);

  }

}

i am stuck do not really know what to do at this point. would like to try a for loop having it change all of the holes but do now know how to set the imputed hole number to the correct hole and have it increasing as it goes amount http://pastebin.com/BdxyzLP8

Posted Sep 16, 2015, 5:41 AM UTC · edited

12
Loading comments…