コード例 #1
0
ファイル: Reversy.java プロジェクト: constcoh/REVERCY
 private void goAuto() {
   playerAuto.go();
   updateViews();
   while (!board.isAbleForGo(playerGamer.getId())) {
     if (!board.isAbleForGo(playerAuto.getId())) {
       int idWin = board.getIdWinCounterNotAbleForGo();
       sendWinMessage(idWin);
       this.setFinished();
       return;
     }
     sendWaitMessage(View.UserOrAuto.user);
     playerAuto.go();
     updateViews();
   }
 }
コード例 #2
0
ファイル: Reversy.java プロジェクト: constcoh/REVERCY
 private void sendWinMessage(int idWin) {
   int idUser = playerGamer.getId();
   int idAuto = playerAuto.getId();
   int cntUser = board.getCountFromCounters(idUser);
   int cntAuto = board.getCountFromCounters(idAuto);
   for (View view : views) {
     if (idWin == Board.WIN_FIRST && idUser == Board.BOARD_FIRST)
       view.showWin(View.UserOrAutoOrNone.user, cntUser, cntAuto);
     if (idWin == Board.WIN_SECOND && idUser == Board.BOARD_SECOND)
       view.showWin(View.UserOrAutoOrNone.user, cntUser, cntAuto);
     if (idWin == Board.WIN_FIRST && idAuto == Board.BOARD_FIRST)
       view.showWin(View.UserOrAutoOrNone.auto, cntUser, cntAuto);
     if (idWin == Board.WIN_SECOND && idAuto == Board.BOARD_SECOND)
       view.showWin(View.UserOrAutoOrNone.auto, cntUser, cntAuto);
     if (idWin == Board.WIN_DRAW) view.showWin(View.UserOrAutoOrNone.none, cntUser, cntAuto);
   }
 }
コード例 #3
0
ファイル: Reversy.java プロジェクト: constcoh/REVERCY
 public void goUser(Point purpose) // return id Win user
     {
   if (!isInGame) return;
   if (!board.isAbleForGo(playerGamer.getId(), purpose)) return;
   playerGamer.go(purpose);
   updateViews();
   if (!board.isAbleForGo(playerAuto.getId())) {
     if (!board.isAbleForGo(playerGamer.getId())) {
       int idWin = board.getIdWinCounterNotAbleForGo();
       sendWinMessage(idWin);
       this.setFinished();
       return;
     }
     sendWaitMessage(View.UserOrAuto.auto);
     return;
   } else {
     goAuto();
     return;
   }
 }
コード例 #4
0
ファイル: Reversy.java プロジェクト: constcoh/REVERCY
 public int getCountAuto() {
   return board.getCount(playerAuto.getId());
 }