import javabook.*;

/**
 * This class is the top-level controller object for managing
 * all other objects in the HiLo program.
 *
 * @author Dr. Caffeine
 *
 */
class HiLo        // Step 1: Skeleton
{

//--------------------------------
//  Data Members
//--------------------------------

  private MainWindow       mainWindow;
  private MessageBox       messageBox;
  private OutputBox        outputBox; 
  private ResponseBox      responseBox;
  private InputBox         inputBox;

//--------------------------------
//  Constructors
//--------------------------------
  
  /**
   * Default constructor. The default window title is "Drawing Shape".
   */
  public HiLo( )
  {
      mainWindow    = new MainWindow  ("Let’s Play HiLo");
      outputBox     = new OutputBox   ( mainWindow );
      responseBox   = new ResponseBox ( mainWindow );
      messageBox    = new MessageBox  ( mainWindow );
      inputBox      = new InputBox    ( mainWindow );
    
      mainWindow.setVisible( true );
      outputBox.setVisible( true );
  }    

//-------------------------------------------------
//    Public Methods:
// 
//      void    start    (    )
//
//------------------------------------------------
  
  /**
   * Top level method that calls other private methods
   * to play the Hi-Lo games.   
   */
  public void start ( )
  {
      int answer;
      
      describeRules();
  
      answer = responseBox.prompt("Do you want to play a Hi-Lo game?");
  
      while ( answer == ResponseBox.YES ) {
  
          generateSecretNumber( );
    
          playGame();
    
          answer = responseBox.prompt
                               ("Do you want to play another Hi-Lo game?");
    }
  }

//-------------------------------------------------
//    Private Methods:
// 
//    void    describeRules         (      )
//    void    generateSecretNumber  (      )
//    void    playGame              (      )
//
//------------------------------------------------
  
  /**
   * Provides a brief explanation of the program to the user.   
   *
   */    
  private void describeRules( )
  {
    outputBox.printLine("Inside describeRules");         //TEMP
  }

  /**
   * Generates a random number between 1 and 100.   
   *
   */  
  private void generateSecretNumber( )
  {
    outputBox.printLine("Inside generateSecretNumber");   //TEMP
  }
  
  /**
   * Plays one Hi-Lo game.   
   *
   */  
  private void playGame( )
  {
    outputBox.printLine("Inside playGame");              //TEMP
  }
  
}
