/**
 * A "try to survive the undead-infested library" game.
 * <p>
 * Currently a simple text-based game with no input
 * in which a zombie shuffles down a hallway towards the player.
 * The player throws random books at the zombie in an attempt to stay alive.
 * 
 * @author Zach Tomaszewski
 * @version 12 Sept 2007
 */
public class LibraryOfDeath {

  public static void main(String[] args) {

    System.out.println("You are standing at the end of a long row of books.");
    System.out.println("A zombie at the far end shambles towards you.");

    Zombie zombie = new Zombie();

    while (zombie.getLocation() > 0) {
      Book nextBook = new Book();
      System.out.print("You throw a " + nextBook);
      System.out.print(" [" + nextBook.getRange() + " yard range]... "); 
      boolean successfulHit = zombie.takeDamage(nextBook);
      if (successfulHit) {
        System.out.println("HIT!");
      }else {
        System.out.println("miss!");
      }
      if (zombie.isAlive()){
        zombie.move();
        System.out.print("The zombie shambles forward... ");
        System.out.println("to " + zombie.getLocation() + " yards away.");
      }else {
        System.out.println("You killed the zombie!  Oh yeah!!");
        return;  //EXITs program
      }
    }
    System.out.println("The zombie reaches you.  You die a horrible, grisly death.");
  }

}//end Zombie
