/* Chris mulligan
 * Geoff Vaughn, Matt Everhart
 * 
 * This is the main handler class for the game of golf
 * see 
 * 
 */
import java.io.*;
public class Golf {

	public static void main(String[] args) {
		int menuChoice;
		boolean repeat = true;
		
		
		//This outputs a figletted "Welcome to Golf" as a title. It's purty
		System.out.println("__      __   _                    _          ___     _  __");
		System.out.println("\\ \\    / /__| |__ ___ _ __  ___  | |_ ___   / __|___| |/ _|");
		System.out.println(" \\ \\/\\/ / -_) / _/ _ \\ '  \\/ -_) |  _/ _ \\ | (_ / _ \\ |  _|");
		System.out.println("  \\_/\\_/\\___|_\\__\\___/_|_|_\\___|  \\__\\___/  \\___\\___/_|_|");

		while(repeat) {
			//Menu!
			System.out.println("What would you like to do?");
			System.out.println("1) New Game");
			System.out.println("2) Load Game");
			System.out.println("3) Rules");
			System.out.println("4) Quit");
			menuChoice = SavitchIn.readInt();
			
			switch (menuChoice) {
				case 1:
					//New game
					
					break;
				case 2:
					//Load saved game
					loadGame();
					break;
				case 3:
					//Prinout Rules
					printRules();
					break;
				case 4: 
					//Quit
					System.out.println("Bye!");
					System.exit(0);
					break;
			}//menuchoice Switch
		
		} //end while loop
		
	} //end main

	private static void loadGame() {
	String line = new String();
	String filename = new String();

	System.out.print("What file to load?");
	filename = SavitchIn.readLine();
		
		//read in file
		try {
			BufferedReader inputStream = new BufferedReader(new FileReader(filename));
			System.out.println("Loading Game " + filename);
			line = inputStream.readLine();
			while(line != null) {
				//here we find out what the XML junky junk is, and load that into a variable
				line = inputStream.readLine();
			}
		} catch(IOException e) {
			System.out.println("ERROR while loading game " + filename);
		} //end try/catch
	} //end loadGame


	//This just prints out the rules file, rules.txt as specified by rulesFile
	private static void printRules() {
		String rulesFile = new String();
		rulesFile = "rules.txt";
		String line = new String();
		//read in/print out file: rules.txt
		try {
			BufferedReader inputStream = new BufferedReader(new FileReader(rulesFile));
			line = inputStream.readLine();
			while(line != null) {
				System.out.println(line);
				line = inputStream.readLine();
			}
		} catch(IOException e) {
			System.out.println("oops, aparently there are no rules!");
		} //end try/catch
	} //end print rules

	public static void playGame() {
		 
	}

	
} //end class

