/**
 * CS312 Assignment 6.
 *
 * On my honor, <NAME>, this programming assignment is my own work
 * and I have not shared my solution with any other student in the class.
 *
 * A program to play Hangman.
 *
 *  email address:
 *  UTEID:
 *  Unique 5 digit course ID:
 *  Number of slip days used on this assignment:
 */

import java.util.Scanner;

public class Hangman {

    public static void main(String[] args) {
        intro();
        PhraseBank phrases = buildPhraseBank(args);
        // CS312 Students -- Do not create any additional Scanners. Delete this comment when finished
        Scanner keyboard = new Scanner(System.in);

        // CS12 students: add your code here, delete this comment when finished.

        keyboard.close();
    }

    // CS12 students: add your methods here. Delete this comment when finished..

    // Build the PhraseBank.
    // If args is empty or null, build the default phrase bank.
    // If args is not null and has a length greater than 0
    // then the first elements is assumed to be the name of the
    // file to build the PhraseBank from.
    public static PhraseBank buildPhraseBank(String[] args) {
        PhraseBank result;
        if (args == null || args.length == 0
                        || args[0] == null || args[0].length() == 0) {
            result =  new PhraseBank();
            /* CS312 students, uncomment the following line if you
             * would like less predictable behavior from the PhraseBank
             * during testing. NOTE, this line MUST be commented out
             * in the version of the program you turn in
             * or your will fail all tests.
             */
            // CS312 Students, the following line must be a comment in the version you submit. Failure to do so
            // will result in the loss of all correctness points.
            // result = new PhraseBank("HangmanMovies.txt", true); // MUST be commented out in version you submit.
        } else {
            result = new PhraseBank(args[0]);
        }

        return result;
    }

    // Print the intro to the program.
    public static void intro() {
        System.out.println("This program plays the game of hangman.");
        System.out.println();
        System.out.println("The computer will pick a random phrase.");
        System.out.println("Enter letters for your guess.");
        System.out.println("After 5 wrong guesses you lose.");
    }
}
