Commit 2b88db28 authored by Trisha Gee's avatar Trisha Gee
Browse files

[Ch5] More tiny updates to the game; adding be the JVM exercise from the book

parent c3664d15
Loading
Loading
Loading
Loading
+1 −1
Changes for src/main/java/ch5/Game.java: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ public class Game {
    theStartup.setLocationCells(locations);
    boolean isAlive = true;

    while (isAlive == true) {
    while (isAlive) {
      int guess = helper.getUserInput("enter a number");
      String result = theStartup.checkYourself(guess);
      numOfGuesses++;
+23 −0
Changes for src/main/java/ch5/Output.java: 23 added lines, 0 removed lines.
Original line number Diff line number Diff line
package ch5;

class Output {

  public static void main(String [] args) {
    Output o = new Output();
    o.go();
  }

  void go() {
    int y = 7;
    for(int x = 1; x < 8; x++) {
      y++;
      if (x > 4) {
        System.out.print(++y + " ");
      }
      if (y > 14) {
        System.out.println(" x = " + x);
        break;
      }
    }
  }
}
+1 −0
Changes for src/main/java/ch5/SimpleStartupTestDrive.java: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ class SimpleStartup {
    if (numOfHits == locationCells.length) {
      result = "kill";
    } // end if
    System.out.println(result);
    return result;
  } // end method
} // close class
 No newline at end of file