/**
 * This class tests is whether a SlotMachine and SlotMachineReel have
 * the correct method signatures.  It also checks that reels change
 * when spun and that face combinations change when the handle is
 * pulled.
 * <p>
 * This file should successfully compile with your
 * SlotMachine and SlotMachineReel.
 *
 * @author Zach Tomaszewski
 */
public class SlotMachineTester {

  public static void main(String[] args) {

    //testing SMReel
    System.out.println("SlotMachineReel:");
    SlotMachineReel reel = new SlotMachineReel();
    String symbol = reel.getFace();
    System.out.println("A new reel shows: " + symbol);
    reel.spin();
    symbol = reel.getFace();
    System.out.println("After a spin: " + symbol);
    System.out.print("getFace() [" + reel.getFace() + "] " +
                     "returns the same symbol as the last " +
                     "spin() [" + symbol + "]?: ");
    System.out.println((symbol.equals(reel.getFace())) ? "PASS" : "FAIL");


    //testing SlotMachine
    //(You can /* comment out */ the following code if you want to use this
    // class to test only your SlotMachineReel before writing the SlotMachine.)
    System.out.println();
    System.out.println("SlotMachine:");
    SlotMachine slots = new SlotMachine();
    String front = slots.toString();
    System.out.println("New slot machine shows: " + front);

    //pulling handle
    System.out.println();
    slots.pullHandle();
    int payout = slots.getPayout();
    String front2 = slots.toString();
    System.out.println("After a pull: " + front2);
    System.out.println("Payout for this combo: " + payout);

    //pulling handle again
    System.out.println();
    slots.pullHandle();
    //results of second pull should be different than above 215/216 of the time
    System.out.println("After a second pull: " + slots); //invoking toString() implicitly
    System.out.println("Payout for this combo: " +  slots.getPayout());

    System.out.println();
    System.out.print("Pulling handle always changes faces: ");
    if (front.equals(front2) || front2.equals(slots.toString())) {
      //NOTE: May not change by chance very occasionally
      System.out.println("[FAIL]");
    }else {
      System.out.println("[PASS]");
    }
    System.out.println("DONE");
  }


}
