コード例 #1
0
 private void startPlaying() {
   while (!dotComsList.isEmpty()) {
     String userGuess = helper.getUserInput("Enter a guess");
     checkUserGuess(userGuess);
   }
   finishGame();
 }
コード例 #2
0
  private void setUpGame() {
    DotCom one = new DotCom();
    one.setName("Pets.com");
    DotCom two = new DotCom();
    two.setName("eToys.com");
    DotCom three = new DotCom();
    three.setName("Go2.com");
    dotComsList.add(one);
    dotComsList.add(two);
    dotComsList.add(three);

    System.out.println("Your goal is to sink three dot coms.");
    System.out.println("Pets.com, eToys.com, Go2.com");
    System.out.println("Try to sink them all in the fewest number of guesses");

    for (DotCom dotComSet : dotComsList) {
      ArrayList<String> newLocation = helper.placeDotCom(3);
      dotComSet.setLocationCells(newLocation);
    }
  }