/* * Created on Jan 27, 2005 */ package mvc373Hw3B; /** Interface for a Towers of Hanoi Game Controller. * See CSE373 05wi Homework #3. * The Controller is a JPanel it can have buttons, etc. * The Controller is also responsible for notifying the View whenever * state has changed. It should do this simply by calling * towerView.repaint(); * * Concrete implementations MUST supply the following constructor: * * public TowerController (ITowerModel towerModel, ITowerView towerView); * * Normally, during the constructor the controller would place buttons, etc. * on the panel. * */ public interface ITowerController { /** Start the game in operation. This would be called once * (from the outside, such as TowerStarter) * to indicate that everything is ready for the first game to begin. * Quite possibly in some implementations there would be nothing * special to do. * * @return true if the start request can be honored; false if it cannot. */ boolean startUp(); /** Start or restart the game from an initial configuration. * @see mvc373Hw3B.ITowerModel.start */ boolean start(int towerCount, int discCount); /** End the game for good. * @return true iff the shutdown request is honored. */ boolean shutDown(); /** Move discs from one tower to another. Reasons why this move * request might fail include: *
* The "from" tower doesn't contain at least the requested number of disks. *
* The top disk on the "to" tower is smaller than the largest disk to * be moved. * * @param discCount the number of discs to move. * @param fromTower the tower which the disks are currently on. * @param toTower the tower to which the disks are to be moved. * @return true iff the move was successfully completed. * @throws IllegalArgumentException if any parameter value is illegal * on the face of it (the towers don't exist, the discCount is out * of range). */ boolean massMove(int discCount, int fromTower, int toTower); /** Stack all disks on a given tower. * * @param goalTower the tower on which all disks are to be stacked. * @return true iff the move succeeded. * @throws IllegalArgumentException if the goalTower does not exist. */ boolean collect(int goalTower); /** Request repainting of the entire controller panel, from scratch. * If the concrete class extends a Component, this is covered already * (you should NOT override it). Unless you want to do some drawing * on the controller panel, you don't even need to override paintComponent. * If you do, see notes under "Getting Started". * */ void repaint(); }