Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. public static void run(GameOfCluedo game, ArrayList<Player> players){
  2. int turn = 1;
  3. Random dice = new Random();
  4. while (1 == 1) { // loop forever
  5. System.out.println("\n********************");
  6. System.out.println("***** TURN " + turn + " *******");
  7. System.out.println("********************\n");
  8. boolean firstTime = true;
  9. for (Player player : players) {
  10. if (!firstTime) {
  11. System.out.println("\n********************\n");
  12. }
  13. firstTime = false;
  14. int roll = dice.nextInt(5) + 1;
  15. System.out.println(player.getName() + " rolls a " + roll + ".");
  16. String toParse = inputString("You are eligible to move "
  17. + roll + " spaces. \n"
  18. + "Use WASD to move and please enter this format 'w2' to move North two spaces."
  19. + "/nyou can also press 'z' to make a suggestion or 'x' to make an accusation.");
  20. char[] arr = toParse.toCharArray();
  21. if (arr.length == 1){
  22. if (arr[0] == 'z'){
  23. //do make an accusation
  24. } else if (arr[0] == 'x'){
  25. //do make a suggestion
  26. } else {
  27. System.out.println("You have entered an incorrect key!");
  28. }
  29. } else if (arr.length == 2){
  30. System.out.println(toParse);
  31. System.out.println(arr[1]);
  32. game.move(arr[0], arr[1], player);
  33. }
  34. game.getBoard().redraw();
  35. }
  36. turn++;
  37. }
  38. }
  39.  
  40. private static boolean inputAccusation(){
  41. String actor = inputString("Please input an actor");
  42. String weapon = inputString("Please input a weapon");
  43. String room = inputString("Please input a room");
  44.  
  45. return false;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement