Trek.java
By: a guest | Mar 16th, 2010 | Syntax:
Java | Size: 1.48 KB | Hits: 47 | Expires: Never
/**
* Trek / Driver class of Trek 2010
* Assignment 4 - Trek.java
*
* The Trek class creates a new game by creating a new CommandProcessor
* object and calling the start() method of that object. Game begins,
* and when finished, returns to caller (Trek). This class then checks
* if the game was won or lost, and displays an appropriate sign-off
* message.
*
* Methods for use outside this class:
* - None
*
* Algorithm for Trek documented through in-line comments.
*
* Class files required:
* - Trek.java
* - Galaxy.java
* - StarShip.java
* - CommandProcessor.java
* - GameStatus.java
*
* Version 1.0 - Created March 16, 2010
*
* Name: Steven Fowler
* ID: 10044302
*
*
*/
public class Trek
{
// Define the main method to be called by the OS at compile-time:
public static void main(String[] args)
{
// Create a new CommandProcessor called newGame:
CommandProcessor newGame = new CommandProcessor();
// Call newGame's start() method to begin playing:
newGame.start();
// Determine whether the game was won or lost after game exits:
if (newGame.currentGame.gameLost)
System.out.println("You've lost the game. Better luck next time!");
else if (newGame.currentGame.gameWon)
System.out.println("Congratulations! You've won the game!");
// Print a sign-off message:
System.out.println(" - Thank you for playing Trek 2010 by Steven Fowler - ");
} // End of main()
} // End of class Trek