public final boolean processString(String str){
  if (getGameState() != GameState.ALIVE)   return false;
  if (str.startsWith("draw ")) {
    String drawCmd=str.substring(str.indexOf(" ") + 1);
    handleDrawCmd(drawCmd,true);
    return true;
  }
 else   if (str.equals("resign")) {
    addToGameTree(new Move(0,0,0),"resign");
    return true;
  }
  Move m=TextIO.UCIstringToMove(str);
  if (m != null)   if (!TextIO.isValid(currPos(),m))   m=null;
  if (m == null)   m=TextIO.stringToMove(currPos(),str);
  if (m == null)   return false;
  addToGameTree(m,pendingDrawOffer ? "draw offer" : "");
  return true;
}

public final boolean processString ( String str ) { if ( getGameState ( ) != GameState . ALIVE ) return false ; if ( str . startsWith ( "draw " ) ) { String drawCmd = str . substring ( str . indexOf ( " " ) + 1 ) ; handleDrawCmd ( drawCmd , true ) ; return true ; } else if ( str . equals ( "resign" ) ) { addToGameTree ( new Move ( 0 , 0 , 0 ) , "resign" ) ; return true ; } Move m = TextIO . UCIstringToMove ( str ) ; if ( m != null ) if ( ! TextIO . isValid ( currPos ( ) , m ) ) m = null ; if ( m == null ) m = TextIO . stringToMove ( currPos ( ) , str ) ; if ( m == null ) return false ; addToGameTree ( m , pendingDrawOffer ? "draw offer" : "" ) ; return true ; }
update the game state according to move / command string from a player .
