import java.util.Scanner;

/**
 * Simple, text-based interface for playing "Hunt the Wumpus"
 *   @author Dave Reed
 *   @version 3/3/12
 */
public class HuntTheWumpus {
    public static void playGame() throws java.io.FileNotFoundException {
        CaveMaze maze = new CaveMaze("caves.txt");
        
        System.out.println("HUNT THE WUMPUS:  Your mission is to explore the maze of caves");
        System.out.println("and destroy all of the wumpi (without getting yourself killed).");
        System.out.println("To move to an adjacent cave, enter 'M' and the tunnel number.");
        System.out.println("To toss a grenade into a cave, enter 'T' and the tunnel number.");
        System.out.println();
        
        Scanner input = new Scanner(System.in);
        while (maze.stillAlive() && maze.stillWumpi()) {
            System.out.println(maze.showLocation());
            
            String action = input.next();
            int target = input.nextInt();
            if (action.toLowerCase().charAt(0) == 't' && target >= 1 && target <= 3) {
                System.out.println(maze.toss(target));
            }
            else if (action.toLowerCase().charAt(0) == 'm' && target >= 1 && target <= 3) {
                System.out.println(maze.move(target));
            }
            else {
                System.out.println("Unrecognized command -- please try again.");
            }
        }
        System.out.println("GAME OVER");
    }
}
