Advertisement
Guest User

State_Space_Explorer_2.java

a guest
May 15th, 2021
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.85 KB | None | 0 0
  1. //  Sokoban state space explorer.
  2. //  Discussion: https://dxdy.ru/topic144781.html
  3.  
  4. public class State_Space_Explorer_2 {
  5.    
  6.     private static final String fileName = "..\\Microcosmos.txt";
  7. //    private static final String fileName = "..\\Original.txt";
  8. //    private static final String fileName = "..\\Yoshio52.txt";
  9.     private static final int mapIndex = 10;
  10.    
  11.     public static void main (String [] args) {
  12.         String []  mapLines;
  13.         MapLoader  mapLoader     = new MapLoader ();
  14.         MapHandler mapHandler    = new MapHandler ();
  15.         StateProcessor processor = new StateProcessor (mapHandler);
  16.        
  17.         if (!mapLoader .openFile (fileName)) {
  18.             return;
  19.         }
  20.        
  21.         /*
  22.         int k = 0;
  23.         while (mapLoader .loadNext ()) {
  24.             System .out .println ("Map index: " + k);
  25.             MapLoader .displayLines (mapLoader .getMapLines ());
  26.             System .out .println ();
  27.             ++k;
  28.         }
  29.         //*/
  30.        
  31.         mapLoader .skip (mapIndex);
  32.         mapLoader .loadNext ();
  33.         mapLoader .closeFile ();
  34.        
  35.         if (!mapLoader .hasLines ()) {
  36.             System .out .println ("No map.");
  37.             return;
  38.         }
  39.        
  40.         mapLines = mapLoader .getMapLines ();
  41.         MapLoader .displayLines (mapLines);
  42.         if (mapHandler .process (mapLines)) {
  43.             System .out .println (mapHandler .getErrorMessage ());
  44.             return;
  45.         }
  46.         //mapHandler .displayMaze ();
  47.         mapHandler .displayMazeWithActiveCells ();
  48.        
  49.         System .out .println ();
  50.         processor .displayMapStats ();
  51.         System .out .println ();
  52.        
  53.         processor .run (false);
  54.         processor .displaySetStats ();
  55.        
  56.         processor .run (true);
  57.         processor .displaySetStats ();
  58.     }
  59. }
  60.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement