コード例 #1
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;
  }