public Integer processCommand( int command ) {
        Integer result = new Integer( ROGER );
        int answer = 0;
        String resignMessage = null;
        System.out.println( "Entered processCommand." );
        
        // If a draw offer is recieved, fire off an action event to inform the
   	//    GUI.
        if ( command == DRAWOFFER ) {
            answer = JOptionPane.showConfirmDialog( null, "The remote player"
                                                    + " has requested a draw."
                                                    + "\n\nWill you agree to a"
                                                    + " draw?",
                                                    "Draw offer",
                                                  JOptionPane.YES_NO_OPTION );
	    
            // Make the answer readable by the remote player object
            if ( answer == JOptionPane.YES_OPTION ) {
                result = new Integer( ACCEPTDRAW );
            } else {
                result = new Integer( REFUSEDRAW );
            }
	    
          // Locally, this answer will be returned and sent by waitForPlayer()
        }
	
        // If a draw accept is recieved, fire off an action event to
   	  //    inform the GUI and call endGame in theDriver.
        else if ( command == ACCEPTDRAW ) {
            JOptionPane.showMessageDialog( null,
                               "The remote player has accepted your draw offer."
                               + "\n\nClick OK to end the program.",
                               "Draw offer accepted",
                               JOptionPane.INFORMATION_MESSAGE );
            // theDriver.endGame();
        }
	
        // If a draw is refused, let the user know and proceed with the game.
        else if ( command == REFUSEDRAW ) {
            JOptionPane.showMessageDialog( null,
                               "The remote player has refused your draw offer."
                               + "\n\nClick OK to continue the game.",
                               "Draw offer refused",
                               JOptionPane.INFORMATION_MESSAGE );
        }
	
        // If a resign command is received, inform the user and exit the game
        else if ( command == RESIGN ) {
            JOptionPane.showMessageDialog( null,
                               "The remote player has resigned."
                               + "\n\nClick OK to end the program.",
                               "Remote resignation",
                               JOptionPane.WARNING_MESSAGE );
            cleanup();
            // theDriver.endGame();
        }
	
        // If an end of game command is received, wait for a text message to
   	//    be sent over and then fire off an action event to tell the GUI
   	//    to display the message in a dialogue box when the user clicks OK,
   	//    endGame should be called in theDriver.
        else if ( command == ENDOFGAME ) {
            String endMessage = null;
            try {
                endMessage = (String) in.readObject();
            } catch ( Exception e ) {
                   // add better error detect later
                   System.err.println( "Error reading end of game message from"
                                       + " network stream:\n" + e);
            }
            JOptionPane.showMessageDialog( null,
                               endMessage
                               + "n\nClick OK to end the program.",
                               "End of game",
                               JOptionPane.INFORMATION_MESSAGE );
            
            cleanup();
        } else {
            
            System.err.println( "Bad command received over network stream."
                             + "  Unrecoverable error.  Program exiting..." );
            //theDriver.endGame();
        }
        return result;
   }