import java.io.*; // class Kalah: Kalah game main class public class Kalah{ public static void main() { } // add code: run the game private void gameStart() { } // add code: the computer makes a move private void computerMove() { } // add code: the player makes a move private void playerMove() { } // add code: check whether the game is over private void checkForWin() { } } // class Gamestate: number of stones in each hole in a certain state public class Gamestate{ private int[] computerHoles; private int[] playerHoles; private int computerKalah; private int playerKalah; } // class IOactions: input and output during the game public class IOactions{ private void printState(Gamestate Holes){ System.out.print("Current state:\n\n"); System.out.print("Computer Holes: 6 5 4 3 2 1\n"); System.out.print(" "); for(int i=0;i<6;i++){ System.out.print(Holes.computerHoles[i]+" "); } System.out.print("\n"); System.out.print(Holes.computerKalah + " " + Holes.playerKalah + "\n"); System.out.print(" "); for(int i=5;i>=0;i--){ System.out.print(Holes.playerHoles[i]+" "); } System.out.print("\n"); System.out.print("Human Holes: 1 2 3 4 5 6\n\n"); System.out.print("State ends\n"); } private int getHoleNumber(){ // return a hole number from 1~6 System.out.print("Please enter the hole number (1/2/3/4/5/6) \n"); try { int t = System.in.read (); char c = (char) t; if(c=='1') return 1; if(c=='2') return 2; if(c=='3') return 3; if(c=='4') return 4; if(c=='5') return 5; if(c=='6') return 6; else return 0; } catch (IOException e) {System.out.print("error");} return 0; } private void showGameOver(boolean winner){ if (winner==false) System.out.print("The winner is the COMPUTER!\n"); if (winner==true) System.out.print("The winner is YOU!\n"); } private boolean startGameAgain(){ System.out.print("Replay the game? (y/n) \n"); try { int t = System.in.read (); char c = (char) t; if(c=='y') return true; else return false; } catch (IOException e) {System.out.print("error");} return false; } private boolean whosFirst(){ // return true if human makes the first move System.out.print("Who makes the first move, human or computer? (h/c) \n"); try { int t = System.in.read (); char c = (char) t; if(c=='h') return true; else return false; } catch (IOException e) {System.out.print("error");} return false; } }