コード例 #1
0
  @Override
  public void paintBoard() {

    int[] arrSelPositions;

    int lastMove = _jni.getMyMove();
    if (lastMove != 0) {
      arrSelPositions = new int[3];
      arrSelPositions[0] = m_iFrom;
      arrSelPositions[1] = Move.getTo(lastMove);
      arrSelPositions[2] = Move.getFrom(lastMove);
    } else {
      arrSelPositions = new int[1];
      arrSelPositions[0] = m_iFrom;
    }

    _view.paintBoard(_jni, arrSelPositions, null);
  }
コード例 #2
0
  @Override
  protected boolean requestMove(int from, int to) {
    if (_arrPGN.size() <= _jni.getNumBoard() - 1) {
      setMessage("(position allready solved)");
      return super.requestMove(from, to);
    }
    int move = _arrPGN.get(_jni.getNumBoard() - 1)._move;
    int theMove = Move.makeMove(from, to);

    if (Move.equalPositions(move, theMove)) {
      jumptoMove(_jni.getNumBoard());

      updateState();

      setMessage("Correct!");
      _imgStatus.setImageResource(R.drawable.indicator_ok);
      /*
      if(_arrPGN.size() == m_game.getBoard().getNumBoard()-1)
      	play();
      else {
      	jumptoMove(m_game.getBoard().getNumBoard());
      	updateState();
      }*/

      return true;
    } else {
      // check for illegal move
      setMessage(
          "Move "
              + Move.toDbgString(theMove)
              + (checkIsLegalMove(from, to) ? " is not the expected move" : " is an invalid move"));
      _imgStatus.setImageResource(R.drawable.indicator_error);
      m_iFrom = -1;
    }

    updateState();

    return true;
  }