Lecture Videos
  1  import java.util.Scanner;
  2  
  3  public class NineTail {
  4    public static void main(String[] args) {
  5      // Prompt the user to enter nine coins H and T's
  6      System.out.print("Enter the initial nine coins Hs and Ts: ");
  7      Scanner input = new Scanner(System.in);
  8      String s = input.nextLine(); 
  9      char[] initialNode = s.toCharArray();
 10  
 11      NineTailModel model = new NineTailModel();
 12      java.util.List<Integer> path =
 13        model.getShortestPath(NineTailModel.getIndex(initialNode));
 14  
 15      System.out.println("The steps to flip the coins are ");
 16      for (int i = 0; i < path.size(); i++)
 17        NineTailModel.printNode(
 18          NineTailModel.getNode(path.get(i)));  
 19    }
 20  }