Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. return (new ScreenHelper()).getUserInput("Enter a guess: ");
  2.  
  3. private int boardLength = 0;
  4. private String[] colors = {"r", "g", "l", "y", "p", "b", "w"};
  5. private ArrayList<String> board = new ArrayList<String>();
  6. private ArrayList<String> tempBoard = new ArrayList<String>();
  7.  
  8. private final int boardLength;
  9. private final String[] colors = {"r", "g", "l", "y", "p", "b", "w"};
  10. private final List<String> board = new ArrayList<String>();
  11. private final List<String> tempBoard = new ArrayList<String>();
  12.  
  13. public void setPlayerName(String n) {
  14. playerName = n;
  15. }
  16.  
  17. public String getPlayerName() {
  18. return playerName;
  19. }
  20.  
  21. public class ScreenHelper {
  22.  
  23. private ScreenHelper ();
  24.  
  25. public static String getUserInput(String prompt) {
  26. String inputLine = null;
  27. System.out.print(prompt + " ");
  28. try {
  29. BufferedReader is = new BufferedReader(new InputStreamReader(System.in));
  30. inputLine = is.readLine();
  31. if (inputLine.length() == 0 ) return null;
  32. } catch (IOException e) {
  33. System.out.println("IOException: " + e);
  34. }
  35. return inputLine;
  36. }
  37. }
  38.  
  39. public class Console {
  40.  
  41. private Console ();
  42.  
  43. public static String userInput(String msg) {
  44. String inputLine = null;
  45. System.out.print(prompt + " ");
  46. try {
  47. BufferedReader is = new BufferedReader(new InputStreamReader(System.in));
  48. inputLine = is.readLine();
  49. if (inputLine.length() == 0 ) return null;
  50. } catch (IOException e) {
  51. System.out.println("IOException: " + e);
  52. }
  53. return inputLine;
  54. }
  55.  
  56. public static void output(String msg, boolean newline) {
  57. System.out.print(msg);
  58. if (newline) {
  59. System.out.println();
  60. }
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement