Пример #1
0
  public static void main(String[] orgs) {

    int numOfGuesses = 0;

    GameHelper helper = new GameHelper();

    SimpleDotCom theDotCom = new SimpleDotCom();

    int startNum = (int) (Math.random() * 5);

    int[] locations = {startNum, startNum + 1, startNum + 2};

    theDotCom.setLocationCells(locations);

    boolean isAlive = true;

    while (isAlive == true) {
      String guess = helper.getUserInput("enter a number");
      String result = theDotCom.checkYourself(guess);

      numOfGuesses++;

      System.out.println(numOfGuesses);

      if (result.equals("kill")) {
        isAlive = false;
        System.out.println("You took " + numOfGuesses + " guesses.");
      }
    }
  }
Пример #2
0
 @Override
 protected void onCreate(Bundle b) {
   super.onCreate(b);
   mHelper = new GameHelper(this);
   mGameHandler = new Handler();
   if (mDebugLog) {
     mHelper.enableDebugLog(mDebugLog, mDebugTag);
   }
   mHelper.setup(this, mRequestedClients, mAdditionalScopes);
 }
Пример #3
0
 protected void enableDebugLog(boolean enabled, String tag) {
   mDebugLog = true;
   mDebugTag = tag;
   if (mHelper != null) {
     mHelper.enableDebugLog(enabled, tag);
   }
 }
Пример #4
0
 public GameHelper getGameHelper() {
   if (mHelper == null) {
     mHelper = new GameHelper(this, mRequestedClients);
     mHelper.enableDebugLog(mDebugLog);
   }
   return mHelper;
 }
Пример #5
0
 @Override
 protected void onCreate(Bundle b) {
   super.onCreate(b);
   if (mHelper == null) {
     getGameHelper();
   }
   mHelper.setup(this);
 }
Пример #6
0
  /**
   * Changes the player
   *
   * @return if the player has been toggled (if the opponent player can play)
   */
  private boolean togglePlayer() {

    int current = gameLogic.getCurrentPlayer();
    boolean toggled;
    // if the next player can play (has at least one place to put the
    // chip)
    if (!gameLogic.isBlockedPlayer(GameHelper.opponent(current))) {
      // just toggles
      gameLogic.setCurrentPlayer(GameHelper.opponent(current));
      toggled = true;
    } else {
      System.out.println(
          String.format("player %d cannot play!!!!!!!!!!!!!!!!!!!", GameHelper.opponent(current)));
      toggled = false;
    }
    return toggled;
  }
Пример #7
0
  public static void main(String[] args) {
    System.out.println("Welcome, Please keep guessing till you get a Kill!!");

    GameHelper helper = new GameHelper();
    SimpleDotCom theDotCom = new SimpleDotCom();
    int randomNum = (int) (Math.random() * 5);
    ArrayList locations = new ArrayList();
    locations.add(randomNum);
    locations.add(randomNum + 1);
    locations.add(randomNum + 2);

    theDotCom.setLocationCells(locations);
    boolean isAlive = true;
    while (isAlive == true) {
      String guess = helper.getUserInput("Enter a number");
      String result = theDotCom.checkYourself(guess);
      System.out.println(result);
      numOfGuesses++;
      if (theDotCom.a == 1) {
        isAlive = false;
      } // close if
    } // close while
  }
Пример #8
0
 protected void reconnectClients(int whichClients) {
   mHelper.reconnectClients(whichClients);
 }
Пример #9
0
 protected GoogleApiClient getApiClient() {
   return mHelper.getApiClient();
 }
Пример #10
0
 protected String getInvitationId() {
   return mHelper.getInvitationId();
 }
Пример #11
0
 protected PlusClient getPlusClient() {
   return mHelper.getPlusClient();
 }
Пример #12
0
 public boolean isSignedIn() {
   return mHelper.isSignedIn();
 }
Пример #13
0
 protected void reconnectClient() {
   mHelper.reconnectClient();
 }
Пример #14
0
 protected AppStateClient getAppStateClient() {
   return mHelper.getAppStateClient();
 }
Пример #15
0
 @Override
 protected void onStop() {
   super.onStop();
   mHelper.onStop();
 }
Пример #16
0
 @Override
 protected void onActivityResult(int request, int response, Intent data) {
   super.onActivityResult(request, response, data);
   mHelper.onActivityResult(request, response, data);
 }
Пример #17
0
 protected boolean hasSignInError() {
   return mHelper.hasSignInError();
 }
Пример #18
0
 protected boolean isSignedIn() {
   return mHelper.isSignedIn();
 }
Пример #19
0
 protected void beginUserInitiatedSignIn() {
   mHelper.beginUserInitiatedSignIn();
 }
Пример #20
0
 protected void signOut() {
   mHelper.signOut();
 }
Пример #21
0
 protected void showAlert(String title, String message) {
   mHelper.makeSimpleDialog(title, message).show();
 }
Пример #22
0
 protected String getScopes() {
   return mHelper.getScopes();
 }
Пример #23
0
 protected GamesClient getGamesClient() {
   return mHelper.getGamesClient();
 }
Пример #24
0
 protected String[] getScopesArray() {
   return mHelper.getScopesArray();
 }
Пример #25
0
 protected void enableDebugLog(boolean enabled) {
   mDebugLog = true;
   if (mHelper != null) {
     mHelper.enableDebugLog(enabled);
   }
 }
Пример #26
0
 protected GameHelper.SignInFailureReason getSignInError() {
   return mHelper.getSignInError();
 }
Пример #27
0
 @Override
 protected void onStart() {
   super.onStart();
   mHelper.onStart(this);
 }