Advertisement
cc11rocks

Untitled

Apr 7th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. import GameHelper;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Game {
  6.     public static void main(String[] args)
  7.     {
  8.         int numOfGuesses = 0;
  9.         GameHelper helper = new GameHelper();
  10.        
  11.         SimpleDotCom theDotCom = new SimpleDotCom();
  12.         int randomNum = (int) (Math.random() * 5);
  13.        
  14.         int[] locations = {randomNum, randomNum+1, randomNum+2};
  15.         theDotCom.setLocationCells(locations);
  16.         boolean isAlive = true;
  17.         while (isAlive == true)
  18.         {
  19.             String guess = helper.getUserInput("enter a number");
  20.             String result = theDotCom.checkYourself(guess);
  21.             numOfGuesses++;
  22.             if (result.equals("kill")) {
  23.                 isAlive = false;
  24.                 System.out.println("You took " + numOfGuesses + " guesses");
  25.             }
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement