changes
authorjzhou <jzhou>
Wed, 3 Sep 2008 18:06:14 +0000 (18:06 +0000)
committerjzhou <jzhou>
Wed, 3 Sep 2008 18:06:14 +0000 (18:06 +0000)
13 files changed:
Robust/src/Benchmarks/MMG/Java/Ghost.java
Robust/src/Benchmarks/MMG/Java/Map.java
Robust/src/Benchmarks/MMG/Java/Node.java [deleted file]
Robust/src/Benchmarks/MMG/Java/Pacman.java
Robust/src/Benchmarks/MMG/Nor/Ghost.java
Robust/src/Benchmarks/MMG/Nor/MMG.java
Robust/src/Benchmarks/MMG/Nor/Map.java
Robust/src/Benchmarks/MMG/Nor/Node.java [deleted file]
Robust/src/Benchmarks/MMG/Nor/Pacman.java
Robust/src/Benchmarks/MMG/Tag/Ghost.java
Robust/src/Benchmarks/MMG/Tag/Map.java
Robust/src/Benchmarks/MMG/Tag/Node.java [deleted file]
Robust/src/Benchmarks/MMG/Tag/Pacman.java

index 1793f49e91e089fe6a77d8cb53474287dac0eca5..9b3c46f2947d3a15fd8f59717d73ff5ad9a5b24d 100755 (executable)
@@ -30,7 +30,7 @@ public class Ghost {
     
     private void setNextDirection() {
        // current position of the ghost
-       Node start = this.m_map.m_mapNodes[this.m_locY * this.m_map.m_nrofblocks + this.m_locX];
+       int start = this.m_locY * this.m_map.m_nrofblocks + this.m_locX;
        boolean set = false;
        Vector cuts = new Vector();
        int tmptarget = 0;
@@ -57,7 +57,7 @@ public class Ghost {
                //System.printString("Target: " + this.m_target + "\n");
                while(!found) {
                    int parent = parents[index];
-                   if(parent == start.getIndex()) {
+                   if(parent == start) {
                        found = true;
                    } else {
                        index = parent;
@@ -65,8 +65,8 @@ public class Ghost {
                }
 
                // set the chase direction
-               int nx = this.m_map.m_mapNodes[index].getXLoc();
-               int ny = this.m_map.m_mapNodes[index].getYLoc();
+               int nx = index % this.m_map.m_nrofblocks;
+               int ny = index / this.m_map.m_nrofblocks;
                this.m_dx = nx - this.m_locX;
                this.m_dy = ny - this.m_locY;
                if(this.m_dx > 0) {
@@ -114,17 +114,17 @@ public class Ghost {
     // Array parents records parent for a node in the BFS search,
     // the last item of parents records the least steps to reach end node from start node
     // Vector cuts specifies which nodes can not be the first one to access in this BFS
-    private boolean BFS(Node start, int[] parents, Vector cuts) {
+    private boolean BFS(int start, int[] parents, Vector cuts) {
        int steps = 0;
        Vector toaccess = new Vector();
-       toaccess.addElement(start);
+       toaccess.addElement(new Integer(start));
        while(toaccess.size() > 0) {
            //System.printString("bbb\n");
            // pull out the first one to access
-           Node access = (Node)toaccess.elementAt(0);
+           int access = ((Integer)toaccess.elementAt(0)).intValue();
            toaccess.removeElementAt(0);
            for(int i = 0; i < this.m_map.m_pacMenX.length; i++) {
-               if((access.getXLoc() == this.m_map.m_pacMenX[i]) && (access.getYLoc() == this.m_map.m_pacMenY[i])) {
+               if(((access%this.m_map.m_nrofblocks) == this.m_map.m_pacMenX[i]) && ((access/this.m_map.m_nrofblocks) == this.m_map.m_pacMenY[i])) {
                    // hit one pacman
                    this.m_target = i;
                    parents[parents.length - 1] = steps;
@@ -132,26 +132,26 @@ public class Ghost {
                }
            }
            steps++;
-           Vector neighbours = access.getNeighbours();
+           Vector neighbours = this.m_map.getNeighbours(access);
            for(int i = 0; i < neighbours.size(); i++) {
-               Node neighbour = (Node)neighbours.elementAt(i);
-               if(parents[neighbour.getIndex()] == -1) {
+               int neighbour = ((Integer)neighbours.elementAt(i)).intValue();
+               if(parents[neighbour] == -1) {
                    // not accessed
                    boolean ignore = false;
-                   if(access.getIndex() == start.getIndex()) {
+                   if(access == start) {
                        // start node, check if the neighbour node is in cuts
                        int j = 0;
                        while((!ignore) && (j < cuts.size())) {
                            int tmp = ((Integer)cuts.elementAt(j)).intValue();
-                           if(tmp == neighbour.getIndex()) {
+                           if(tmp == neighbour) {
                                ignore = true;
                            }
                            j++;
                        }
                    }
                    if(!ignore) {
-                       parents[neighbour.getIndex()] = access.getIndex();
-                       toaccess.addElement(neighbour);
+                       parents[neighbour] = access;
+                       toaccess.addElement(new Integer(neighbour));
                    }
                }
            }
index 5cf209754d339cfb89ae3faf36a77cd1b8db63f6..4720b2e826b7c3d44dc66477462803a6e8cda1b7 100755 (executable)
@@ -2,7 +2,6 @@ public class Map {
     // maze\r
     private int m_nrofblocks;\r
     public int[] m_map;\r
-    public Node[] m_mapNodes;\r
     public Ghost[] m_ghosts;\r
     public Pacman[] m_pacmen;\r
     \r
@@ -31,7 +30,6 @@ public class Map {
        //System.printString("step 1\n");\r
        this.m_nrofblocks = 15;\r
        this.m_map = new int[this.m_nrofblocks*this.m_nrofblocks];\r
-       this.m_mapNodes = new Node[this.m_nrofblocks*this.m_nrofblocks];\r
        \r
        this.m_nrofpacs = nrofpacs;\r
        this.m_pacMenX = new int[this.m_nrofpacs];\r
@@ -56,7 +54,6 @@ public class Map {
        \r
        for(int i = 0; i < this.m_nrofblocks*this.m_nrofblocks; i++) {\r
            this.m_map[i] = -1;\r
-           this.m_mapNodes[i] = new Node(i%this.m_nrofblocks, i/this.m_nrofblocks, i);\r
        }\r
        \r
        //System.printString("step 2\n");\r
@@ -92,46 +89,6 @@ public class Map {
        this.m_map[i++]=1;this.m_map[i++]=10;this.m_map[i++]=10;this.m_map[i++]=6;this.m_map[i++]=13;this.m_map[i++]=5;this.m_map[i++]=11;this.m_map[i++]=2;this.m_map[i++]=14;this.m_map[i++]=5;this.m_map[i++]=13;this.m_map[i++]=3;this.m_map[i++]=10;this.m_map[i++]=10;this.m_map[i++]=4;\r
        this.m_map[i++]=5;this.m_map[i++]=11;this.m_map[i++]=14;this.m_map[i++]=1;this.m_map[i++]=10;this.m_map[i++]=8;this.m_map[i++]=6;this.m_map[i++]=13;this.m_map[i++]=3;this.m_map[i++]=8;this.m_map[i++]=10;this.m_map[i++]=4;this.m_map[i++]=11;this.m_map[i++]=14;this.m_map[i++]=5;\r
        this.m_map[i++]=9;this.m_map[i++]=10;this.m_map[i++]=10;this.m_map[i++]=12;this.m_map[i++]=3;this.m_map[i++]=6;this.m_map[i++]=9;this.m_map[i++]=10;this.m_map[i++]=12;this.m_map[i++]=3;this.m_map[i++]=6;this.m_map[i++]=9;this.m_map[i++]=10;this.m_map[i++]=10;this.m_map[i++]=12; // 15*15\r
-       \r
-       // initilize the graph of the maze\r
-       for(i = 0; i < this.m_nrofblocks*this.m_nrofblocks; i++) {\r
-           int tmp = this.m_map[i];\r
-           Node tmpNode = this.m_mapNodes[i];\r
-           int locX = tmpNode.getXLoc();\r
-           int locY = tmpNode.getYLoc();\r
-           if((int)(tmp & 1) == 0) {\r
-               // can go left\r
-               if(locX == 0) {\r
-                   tmpNode.addNeighbour(this.m_mapNodes[locY * this.m_nrofblocks + this.m_nrofblocks - 1]);\r
-               } else {\r
-                   tmpNode.addNeighbour(this.m_mapNodes[i - 1]);\r
-               }\r
-           } \r
-           if((int)(tmp & 2) == 0) {\r
-               // can go up\r
-               if(locY == 0) {\r
-                   tmpNode.addNeighbour(this.m_mapNodes[(this.m_nrofblocks - 1) * this.m_nrofblocks + locX]);\r
-               } else {\r
-                   tmpNode.addNeighbour(this.m_mapNodes[(locY - 1) * this.m_nrofblocks + locX]);\r
-               }\r
-           }\r
-           if((int)(tmp & 4) == 0) {\r
-               // can go right\r
-               if(locX == this.m_nrofblocks - 1) {\r
-                   tmpNode.addNeighbour(this.m_mapNodes[locY * this.m_nrofblocks]);\r
-               } else {\r
-                   tmpNode.addNeighbour(this.m_mapNodes[i + 1]);\r
-               }\r
-           }\r
-           if((int)(tmp & 8) == 0) {\r
-               // can go down\r
-               if(locY == this.m_nrofblocks - 1) {\r
-                   tmpNode.addNeighbour(this.m_mapNodes[locX]);\r
-               } else {\r
-                   tmpNode.addNeighbour(this.m_mapNodes[(locY + 1) * this.m_nrofblocks + locX]);\r
-               }\r
-           }\r
-       }\r
     } \r
 \r
     public void placePacman(Pacman t) {\r
@@ -176,4 +133,44 @@ public class Map {
     public boolean isfinish() {\r
        return this.m_nrofpacs == 0;\r
     }\r
+    \r
+    public Vector getNeighbours(int index) {\r
+       Vector neighbours = new Vector();\r
+       int tmp = this.m_map[index];\r
+       int locX = index % this.m_nrofblocks;\r
+       int locY = index / this.m_nrofblocks;\r
+       if((int)(tmp & 1) == 0) {\r
+           // can go left\r
+           if(locX == 0) {\r
+               neighbours.addElement(new Integer(locY * this.m_nrofblocks + this.m_nrofblocks - 1));\r
+           } else {\r
+               neighbours.addElement(new Integer(index - 1));\r
+           }\r
+       } \r
+       if((int)(tmp & 2) == 0) {\r
+           // can go up\r
+           if(locY == 0) {\r
+               neighbours.addElement(new Integer((this.m_nrofblocks - 1) * this.m_nrofblocks + locX));\r
+           } else {\r
+               neighbours.addElement(new Integer((locY - 1) * this.m_nrofblocks + locX));\r
+           }\r
+       }\r
+       if((int)(tmp & 4) == 0) {\r
+           // can go right\r
+           if(locX == this.m_nrofblocks - 1) {\r
+               neighbours.addElement(new Integer(locY * this.m_nrofblocks));\r
+           } else {\r
+               neighbours.addElement(new Integer(index + 1));\r
+           }\r
+       }\r
+       if((int)(tmp & 8) == 0) {\r
+           // can go down\r
+           if(locY == this.m_nrofblocks - 1) {\r
+               neighbours.addElement(new Integer(locX));\r
+           } else {\r
+               neighbours.addElement(new Integer((locY + 1) * this.m_nrofblocks + locX));\r
+           }\r
+       }\r
+       return neighbours;\r
+    }\r
 }\r
diff --git a/Robust/src/Benchmarks/MMG/Java/Node.java b/Robust/src/Benchmarks/MMG/Java/Node.java
deleted file mode 100644 (file)
index bcc4d3e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-public class Node {
-    
-    int m_locX;
-    int m_locY;
-    int m_index;
-    Vector m_neighbours;
-    
-    public Node(int locX, int locY, int index) {
-       this.m_locX = locX;
-       this.m_locY = locY;
-       this.m_index = index;
-       this.m_neighbours = new Vector();
-    }
-    
-    public void addNeighbour(Node n) {
-       this.m_neighbours.addElement(n);
-    }
-    
-    public Vector getNeighbours() {
-       return this.m_neighbours;
-    }
-    
-    public int getXLoc() {
-       return this.m_locX;
-    }
-    
-    public int getYLoc() {
-       return this.m_locY;
-    }
-    
-    public int getIndex() {
-       return this.m_index;
-    }
-}
\ No newline at end of file
index 6cbff494525518dd421dc0ea5963045a2c136943..386704e5df275e47ed33c647afdf425504fb8b26 100755 (executable)
@@ -35,7 +35,7 @@ public class Pacman {
     \r
     private void setNextDirection() {\r
        // current position of the ghost\r
-       Node start = this.m_map.m_mapNodes[this.m_locY * this.m_map.m_nrofblocks + this.m_locX];\r
+       int start = this.m_locY * this.m_map.m_nrofblocks + this.m_locX;\r
        \r
        // get target's position\r
        int targetx = this.m_tx;\r
@@ -44,7 +44,7 @@ public class Pacman {
        nextLocation[0] = nextLocation[1] = -1;\r
        \r
        // target's position\r
-       Node end = this.m_map.m_mapNodes[targety * this.m_map.m_nrofblocks + targetx];\r
+       int end = targety * this.m_map.m_nrofblocks + targetx;\r
        \r
        // breadth-first traverse the graph view of the maze\r
        // check the shortest path for the start node to the end node\r
@@ -68,10 +68,10 @@ public class Pacman {
            } else {\r
                // Reversely go over the parents array to find the next node to reach\r
                boolean found = false;\r
-               int index = end.getIndex();\r
+               int index = end;\r
                while(!found) {\r
                    int parent = parents[index];\r
-                   if(parent == start.getIndex()) {\r
+                   if(parent == start) {\r
                        found = true;\r
                    } else {\r
                        index = parent;\r
@@ -79,8 +79,8 @@ public class Pacman {
                }\r
 \r
                // set the chase direction\r
-               int nx = this.m_map.m_mapNodes[index].getXLoc();\r
-               int ny = this.m_map.m_mapNodes[index].getYLoc();\r
+               int nx = index % this.m_map.m_nrofblocks;\r
+               int ny = index / this.m_map.m_nrofblocks;\r
                this.m_dx = nx - this.m_locX;\r
                this.m_dy = ny - this.m_locY;\r
                if(this.m_dx > 0) {\r
@@ -127,40 +127,40 @@ public class Pacman {
     // Array parents records parent for a node in the BFS search, \r
     // the last item of parents records the least steps to reach end node from start node\r
     // Vector cuts specifies which nodes can not be the first one to access in this BFS\r
-    private boolean BFS(Node start, Node end, int[] parents, Vector cuts) {\r
+    private boolean BFS(int start, int end, int[] parents, Vector cuts) {\r
        int steps = 0;\r
        Vector toaccess = new Vector();\r
-       toaccess.addElement(start);\r
+       toaccess.addElement(new Integer(start));\r
        while(toaccess.size() > 0) {\r
            // pull out the first one to access\r
-           Node access = (Node)toaccess.elementAt(0);\r
+           int access = ((Integer)toaccess.elementAt(0)).intValue();\r
            toaccess.removeElementAt(0);\r
-           if(access.getIndex() == end.getIndex()) {\r
+           if(access == end) {\r
                // hit the end node\r
                parents[parents.length - 1] = steps;\r
                return true;\r
            }\r
            steps++;\r
-           Vector neighbours = access.getNeighbours();\r
+           Vector neighbours = this.m_map.getNeighbours(access);\r
            for(int i = 0; i < neighbours.size(); i++) {\r
-               Node neighbour = (Node)neighbours.elementAt(i);\r
-               if(parents[neighbour.getIndex()] == -1) {\r
+               int neighbour = ((Integer)neighbours.elementAt(i)).intValue();\r
+               if(parents[neighbour] == -1) {\r
                    // not accessed\r
                    boolean ignore = false;\r
-                   if(access.getIndex() == start.getIndex()) {\r
+                   if(access == start) {\r
                        // start node, check if the neighbour node is in cuts\r
                        int j = 0;\r
                        while((!ignore) && (j < cuts.size())) {\r
                            int tmp = ((Integer)cuts.elementAt(j)).intValue();\r
-                           if(tmp == neighbour.getIndex()) {\r
+                           if(tmp == neighbour) {\r
                                ignore = true;\r
                            }\r
                            j++;\r
                        }\r
                    }\r
                    if(!ignore) {\r
-                       parents[neighbour.getIndex()] = access.getIndex();\r
-                       toaccess.addElement(neighbour);\r
+                       parents[neighbour] = access;\r
+                       toaccess.addElement(new Integer(neighbour));\r
                    }\r
                }\r
            }\r
@@ -265,9 +265,9 @@ public class Pacman {
        \r
        // check the least steps for the ghosts to reach point location\r
        int chasesteps = -1;\r
-       Node end = this.m_map.m_mapNodes[point[1] * this.m_map.m_nrofblocks + point[0]];\r
+       int end = point[1] * this.m_map.m_nrofblocks + point[0];\r
        for(int i = 0; i < this.m_map.m_ghostsX.length; i++) {\r
-           Node start = this.m_map.m_mapNodes[this.m_map.m_ghostsY[i] * this.m_map.m_nrofblocks + this.m_map.m_ghostsX[i]];\r
+           int start = this.m_map.m_ghostsY[i] * this.m_map.m_nrofblocks + this.m_map.m_ghostsX[i];\r
            int parents[] = new int[this.m_map.m_nrofblocks * this.m_map.m_nrofblocks + 1];\r
            for(int j = 0; j < parents.length; j++) {\r
                parents[j] = -1;\r
index 91f3261412df6880205377317f27fe821ebdd590..e150c31e45f181927c62a29fc29a920fbb7e33d6 100755 (executable)
@@ -32,7 +32,7 @@ public class Ghost {
     
     private void setNextDirection() {
        // current position of the ghost
-       Node start = this.m_map.m_mapNodes[this.m_locY * this.m_map.m_nrofblocks + this.m_locX];
+       int start = this.m_locY * this.m_map.m_nrofblocks + this.m_locX;
        boolean set = false;
        Vector cuts = new Vector();
        int tmptarget = 0;
@@ -59,7 +59,7 @@ public class Ghost {
                //System.printString("Target: " + this.m_target + "\n");
                while(!found) {
                    int parent = parents[index];
-                   if(parent == start.getIndex()) {
+                   if(parent == start) {
                        found = true;
                    } else {
                        index = parent;
@@ -67,8 +67,8 @@ public class Ghost {
                }
 
                // set the chase direction
-               int nx = this.m_map.m_mapNodes[index].getXLoc();
-               int ny = this.m_map.m_mapNodes[index].getYLoc();
+               int nx = index % this.m_map.m_nrofblocks;
+               int ny = index / this.m_map.m_nrofblocks;
                this.m_dx = nx - this.m_locX;
                this.m_dy = ny - this.m_locY;
                if(this.m_dx > 0) {
@@ -116,17 +116,18 @@ public class Ghost {
     // Array parents records parent for a node in the BFS search,
     // the last item of parents records the least steps to reach end node from start node
     // Vector cuts specifies which nodes can not be the first one to access in this BFS
-    private boolean BFS(Node start, int[] parents, Vector cuts) {
+    private boolean BFS(int start, int[] parents, Vector cuts) {
+       //System.printString("aaa\n");
        int steps = 0;
        Vector toaccess = new Vector();
-       toaccess.addElement(start);
+       toaccess.addElement(new Integer(start));
        while(toaccess.size() > 0) {
            //System.printString("bbb\n");
            // pull out the first one to access
-           Node access = (Node)toaccess.elementAt(0);
+           int access = ((Integer)toaccess.elementAt(0)).intValue();
            toaccess.removeElementAt(0);
            for(int i = 0; i < this.m_map.m_pacMenX.length; i++) {
-               if((access.getXLoc() == this.m_map.m_pacMenX[i]) && (access.getYLoc() == this.m_map.m_pacMenY[i])) {
+               if(((access%this.m_map.m_nrofblocks) == this.m_map.m_pacMenX[i]) && ((access/this.m_map.m_nrofblocks) == this.m_map.m_pacMenY[i])) {
                    // hit one pacman
                    this.m_target = i;
                    parents[parents.length - 1] = steps;
@@ -134,30 +135,31 @@ public class Ghost {
                }
            }
            steps++;
-           Vector neighbours = access.getNeighbours();
+           Vector neighbours = this.m_map.getNeighbours(access);
            for(int i = 0; i < neighbours.size(); i++) {
-               Node neighbour = (Node)neighbours.elementAt(i);
-               if(parents[neighbour.getIndex()] == -1) {
+               int neighbour = ((Integer)neighbours.elementAt(i)).intValue();
+               if(parents[neighbour] == -1) {
                    // not accessed
                    boolean ignore = false;
-                   if(access.getIndex() == start.getIndex()) {
+                   if(access == start) {
                        // start node, check if the neighbour node is in cuts
                        int j = 0;
                        while((!ignore) && (j < cuts.size())) {
                            int tmp = ((Integer)cuts.elementAt(j)).intValue();
-                           if(tmp == neighbour.getIndex()) {
+                           if(tmp == neighbour) {
                                ignore = true;
                            }
                            j++;
                        }
                    }
                    if(!ignore) {
-                       parents[neighbour.getIndex()] = access.getIndex();
-                       toaccess.addElement(neighbour);
+                       parents[neighbour] = access;
+                       toaccess.addElement(new Integer(neighbour));
                    }
                }
            }
        }
+       //System.printString("ccc\n");
        parents[parents.length - 1] = -1;
        return false;
     }
@@ -320,4 +322,4 @@ public class Ghost {
        this.m_dy = 0;
        //System.printString("Ghost " + this.m_index + ": (" + this.m_locX + ", " + this.m_locY + ")\n");
     }
-}
+}
\ No newline at end of file
index 403924227c9c2e2bacb535f7085807daa39097b8..54043358f946d6484382c8c768fdd0e8c5a52548 100755 (executable)
@@ -134,6 +134,6 @@ task next(Map map{next}) {
 }
 
 task finish(Map map{finish}) {
-   System.printString("Task Finish\n");
+    System.printString("Task Finish\n");
     taskexit(map{!finish});
 }
index 650f0a624a9a4a8552f35ed877315eba7ab87aa8..14903686f51a8d4f985b5cdd164e34a138d04aae 100755 (executable)
@@ -8,7 +8,6 @@ public class Map {
     // maze
     private int m_nrofblocks;
     public int[] m_map;
-    public Node[] m_mapNodes;
     
     // pacmen information
     public int m_nrofpacs;
@@ -36,7 +35,6 @@ public class Map {
        //System.printString("step 1\n");
        this.m_nrofblocks = 15;
        this.m_map = new int[this.m_nrofblocks*this.m_nrofblocks];
-       this.m_mapNodes = new Node[this.m_nrofblocks*this.m_nrofblocks];
        
        this.m_nrofpacs = nrofpacs;
        this.m_pacMenX = new int[this.m_nrofpacs];
@@ -59,7 +57,6 @@ public class Map {
        
        for(int i = 0; i < this.m_nrofblocks*this.m_nrofblocks; i++) {
            this.m_map[i] = -1;
-           this.m_mapNodes[i] = new Node(i%this.m_nrofblocks, i/this.m_nrofblocks, i);
        }
        
        //System.printString("step 2\n");
@@ -93,46 +90,6 @@ public class Map {
        this.m_map[i++]=1;this.m_map[i++]=10;this.m_map[i++]=10;this.m_map[i++]=6;this.m_map[i++]=13;this.m_map[i++]=5;this.m_map[i++]=11;this.m_map[i++]=2;this.m_map[i++]=14;this.m_map[i++]=5;this.m_map[i++]=13;this.m_map[i++]=3;this.m_map[i++]=10;this.m_map[i++]=10;this.m_map[i++]=4;
        this.m_map[i++]=5;this.m_map[i++]=11;this.m_map[i++]=14;this.m_map[i++]=1;this.m_map[i++]=10;this.m_map[i++]=8;this.m_map[i++]=6;this.m_map[i++]=13;this.m_map[i++]=3;this.m_map[i++]=8;this.m_map[i++]=10;this.m_map[i++]=4;this.m_map[i++]=11;this.m_map[i++]=14;this.m_map[i++]=5;
        this.m_map[i++]=9;this.m_map[i++]=10;this.m_map[i++]=10;this.m_map[i++]=12;this.m_map[i++]=3;this.m_map[i++]=6;this.m_map[i++]=9;this.m_map[i++]=10;this.m_map[i++]=12;this.m_map[i++]=3;this.m_map[i++]=6;this.m_map[i++]=9;this.m_map[i++]=10;this.m_map[i++]=10;this.m_map[i++]=12; // 15*15
-       
-       // initilize the graph of the maze
-       for(i = 0; i < this.m_nrofblocks*this.m_nrofblocks; i++) {
-           int tmp = this.m_map[i];
-           Node tmpNode = this.m_mapNodes[i];
-           int locX = tmpNode.getXLoc();
-           int locY = tmpNode.getYLoc();
-           if((int)(tmp & 1) == 0) {
-               // can go left
-               if(locX == 0) {
-                   tmpNode.addNeighbour(this.m_mapNodes[locY * this.m_nrofblocks + this.m_nrofblocks - 1]);
-               } else {
-                   tmpNode.addNeighbour(this.m_mapNodes[i - 1]);
-               }
-           } 
-           if((int)(tmp & 2) == 0) {
-               // can go up
-               if(locY == 0) {
-                   tmpNode.addNeighbour(this.m_mapNodes[(this.m_nrofblocks - 1) * this.m_nrofblocks + locX]);
-               } else {
-                   tmpNode.addNeighbour(this.m_mapNodes[(locY - 1) * this.m_nrofblocks + locX]);
-               }
-           }
-           if((int)(tmp & 4) == 0) {
-               // can go right
-               if(locX == this.m_nrofblocks - 1) {
-                   tmpNode.addNeighbour(this.m_mapNodes[locY * this.m_nrofblocks]);
-               } else {
-                   tmpNode.addNeighbour(this.m_mapNodes[i + 1]);
-               }
-           }
-           if((int)(tmp & 8) == 0) {
-               // can go down
-               if(locY == this.m_nrofblocks - 1) {
-                   tmpNode.addNeighbour(this.m_mapNodes[locX]);
-               } else {
-                   tmpNode.addNeighbour(this.m_mapNodes[(locY + 1) * this.m_nrofblocks + locX]);
-               }
-           }
-       }
     } 
 
     public void placePacman(Pacman t) {
@@ -177,4 +134,44 @@ public class Map {
     public boolean isfinish() {
        return this.m_nrofpacs == 0;
     }
+    
+    public Vector getNeighbours(int index) {
+       Vector neighbours = new Vector();
+       int tmp = this.m_map[index];
+       int locX = index % this.m_nrofblocks;
+       int locY = index / this.m_nrofblocks;
+       if((int)(tmp & 1) == 0) {
+           // can go left
+           if(locX == 0) {
+               neighbours.addElement(new Integer(locY * this.m_nrofblocks + this.m_nrofblocks - 1));
+           } else {
+               neighbours.addElement(new Integer(index - 1));
+           }
+       } 
+       if((int)(tmp & 2) == 0) {
+           // can go up
+           if(locY == 0) {
+               neighbours.addElement(new Integer((this.m_nrofblocks - 1) * this.m_nrofblocks + locX));
+           } else {
+               neighbours.addElement(new Integer((locY - 1) * this.m_nrofblocks + locX));
+           }
+       }
+       if((int)(tmp & 4) == 0) {
+           // can go right
+           if(locX == this.m_nrofblocks - 1) {
+               neighbours.addElement(new Integer(locY * this.m_nrofblocks));
+           } else {
+               neighbours.addElement(new Integer(index + 1));
+           }
+       }
+       if((int)(tmp & 8) == 0) {
+           // can go down
+           if(locY == this.m_nrofblocks - 1) {
+               neighbours.addElement(new Integer(locX));
+           } else {
+               neighbours.addElement(new Integer((locY + 1) * this.m_nrofblocks + locX));
+           }
+       }
+       return neighbours;
+    }
 }
diff --git a/Robust/src/Benchmarks/MMG/Nor/Node.java b/Robust/src/Benchmarks/MMG/Nor/Node.java
deleted file mode 100644 (file)
index bcc4d3e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-public class Node {
-    
-    int m_locX;
-    int m_locY;
-    int m_index;
-    Vector m_neighbours;
-    
-    public Node(int locX, int locY, int index) {
-       this.m_locX = locX;
-       this.m_locY = locY;
-       this.m_index = index;
-       this.m_neighbours = new Vector();
-    }
-    
-    public void addNeighbour(Node n) {
-       this.m_neighbours.addElement(n);
-    }
-    
-    public Vector getNeighbours() {
-       return this.m_neighbours;
-    }
-    
-    public int getXLoc() {
-       return this.m_locX;
-    }
-    
-    public int getYLoc() {
-       return this.m_locY;
-    }
-    
-    public int getIndex() {
-       return this.m_index;
-    }
-}
\ No newline at end of file
index 651b90dc8e2419c095a107a55cb45a94adb57a6b..2737b80c85289c1f21d1bcf81983e7c01156ee40 100755 (executable)
@@ -38,7 +38,7 @@ public class Pacman {
     
     private void setNextDirection() {
        // current position of the ghost
-       Node start = this.m_map.m_mapNodes[this.m_locY * this.m_map.m_nrofblocks + this.m_locX];
+       int start = this.m_locY * this.m_map.m_nrofblocks + this.m_locX;
        
        // get target's position
        int targetx = this.m_tx;
@@ -47,7 +47,7 @@ public class Pacman {
        nextLocation[0] = nextLocation[1] = -1;
        
        // target's position
-       Node end = this.m_map.m_mapNodes[targety * this.m_map.m_nrofblocks + targetx];
+       int end = targety * this.m_map.m_nrofblocks + targetx;
        
        // breadth-first traverse the graph view of the maze
        // check the shortest path for the start node to the end node
@@ -71,10 +71,10 @@ public class Pacman {
            } else {
                // Reversely go over the parents array to find the next node to reach
                boolean found = false;
-               int index = end.getIndex();
+               int index = end;
                while(!found) {
                    int parent = parents[index];
-                   if(parent == start.getIndex()) {
+                   if(parent == start) {
                        found = true;
                    } else {
                        index = parent;
@@ -82,8 +82,8 @@ public class Pacman {
                }
 
                // set the chase direction
-               int nx = this.m_map.m_mapNodes[index].getXLoc();
-               int ny = this.m_map.m_mapNodes[index].getYLoc();
+               int nx = index % this.m_map.m_nrofblocks;
+               int ny = index / this.m_map.m_nrofblocks;
                this.m_dx = nx - this.m_locX;
                this.m_dy = ny - this.m_locY;
                if(this.m_dx > 0) {
@@ -130,40 +130,40 @@ public class Pacman {
     // Array parents records parent for a node in the BFS search, 
     // the last item of parents records the least steps to reach end node from start node
     // Vector cuts specifies which nodes can not be the first one to access in this BFS
-    private boolean BFS(Node start, Node end, int[] parents, Vector cuts) {
+    private boolean BFS(int start, int end, int[] parents, Vector cuts) {
        int steps = 0;
        Vector toaccess = new Vector();
-       toaccess.addElement(start);
+       toaccess.addElement(new Integer(start));
        while(toaccess.size() > 0) {
            // pull out the first one to access
-           Node access = (Node)toaccess.elementAt(0);
+           int access = ((Integer)toaccess.elementAt(0)).intValue();
            toaccess.removeElementAt(0);
-           if(access.getIndex() == end.getIndex()) {
+           if(access == end) {
                // hit the end node
                parents[parents.length - 1] = steps;
                return true;
            }
            steps++;
-           Vector neighbours = access.getNeighbours();
+           Vector neighbours = this.m_map.getNeighbours(access);
            for(int i = 0; i < neighbours.size(); i++) {
-               Node neighbour = (Node)neighbours.elementAt(i);
-               if(parents[neighbour.getIndex()] == -1) {
+               int neighbour = ((Integer)neighbours.elementAt(i)).intValue();
+               if(parents[neighbour] == -1) {
                    // not accessed
                    boolean ignore = false;
-                   if(access.getIndex() == start.getIndex()) {
+                   if(access == start) {
                        // start node, check if the neighbour node is in cuts
                        int j = 0;
                        while((!ignore) && (j < cuts.size())) {
                            int tmp = ((Integer)cuts.elementAt(j)).intValue();
-                           if(tmp == neighbour.getIndex()) {
+                           if(tmp == neighbour) {
                                ignore = true;
                            }
                            j++;
                        }
                    }
                    if(!ignore) {
-                       parents[neighbour.getIndex()] = access.getIndex();
-                       toaccess.addElement(neighbour);
+                       parents[neighbour] = access;
+                       toaccess.addElement(new Integer(neighbour));
                    }
                }
            }
@@ -195,7 +195,7 @@ public class Pacman {
            locX++;
        }
        steps++; 
-       
+
        boolean set = false;
        // Determine next turning location.
        while (!set) {
@@ -268,9 +268,9 @@ public class Pacman {
        
        // check the least steps for the ghosts to reach point location
        int chasesteps = -1;
-       Node end = this.m_map.m_mapNodes[point[1] * this.m_map.m_nrofblocks + point[0]];
+       int end = point[1] * this.m_map.m_nrofblocks + point[0];
        for(int i = 0; i < this.m_map.m_ghostsX.length; i++) {
-           Node start = this.m_map.m_mapNodes[this.m_map.m_ghostsY[i] * this.m_map.m_nrofblocks + this.m_map.m_ghostsX[i]];
+           int start = this.m_map.m_ghostsY[i] * this.m_map.m_nrofblocks + this.m_map.m_ghostsX[i];
            int parents[] = new int[this.m_map.m_nrofblocks * this.m_map.m_nrofblocks + 1];
            for(int j = 0; j < parents.length; j++) {
                parents[j] = -1;
index d7126aedfe4ba6c733f888e2c60a75d7495b03a5..e150c31e45f181927c62a29fc29a920fbb7e33d6 100755 (executable)
@@ -32,7 +32,7 @@ public class Ghost {
     
     private void setNextDirection() {
        // current position of the ghost
-       Node start = this.m_map.m_mapNodes[this.m_locY * this.m_map.m_nrofblocks + this.m_locX];
+       int start = this.m_locY * this.m_map.m_nrofblocks + this.m_locX;
        boolean set = false;
        Vector cuts = new Vector();
        int tmptarget = 0;
@@ -59,7 +59,7 @@ public class Ghost {
                //System.printString("Target: " + this.m_target + "\n");
                while(!found) {
                    int parent = parents[index];
-                   if(parent == start.getIndex()) {
+                   if(parent == start) {
                        found = true;
                    } else {
                        index = parent;
@@ -67,8 +67,8 @@ public class Ghost {
                }
 
                // set the chase direction
-               int nx = this.m_map.m_mapNodes[index].getXLoc();
-               int ny = this.m_map.m_mapNodes[index].getYLoc();
+               int nx = index % this.m_map.m_nrofblocks;
+               int ny = index / this.m_map.m_nrofblocks;
                this.m_dx = nx - this.m_locX;
                this.m_dy = ny - this.m_locY;
                if(this.m_dx > 0) {
@@ -116,18 +116,18 @@ public class Ghost {
     // Array parents records parent for a node in the BFS search,
     // the last item of parents records the least steps to reach end node from start node
     // Vector cuts specifies which nodes can not be the first one to access in this BFS
-    private boolean BFS(Node start, int[] parents, Vector cuts) {
+    private boolean BFS(int start, int[] parents, Vector cuts) {
        //System.printString("aaa\n");
        int steps = 0;
        Vector toaccess = new Vector();
-       toaccess.addElement(start);
+       toaccess.addElement(new Integer(start));
        while(toaccess.size() > 0) {
            //System.printString("bbb\n");
            // pull out the first one to access
-           Node access = (Node)toaccess.elementAt(0);
+           int access = ((Integer)toaccess.elementAt(0)).intValue();
            toaccess.removeElementAt(0);
            for(int i = 0; i < this.m_map.m_pacMenX.length; i++) {
-               if((access.getXLoc() == this.m_map.m_pacMenX[i]) && (access.getYLoc() == this.m_map.m_pacMenY[i])) {
+               if(((access%this.m_map.m_nrofblocks) == this.m_map.m_pacMenX[i]) && ((access/this.m_map.m_nrofblocks) == this.m_map.m_pacMenY[i])) {
                    // hit one pacman
                    this.m_target = i;
                    parents[parents.length - 1] = steps;
@@ -135,26 +135,26 @@ public class Ghost {
                }
            }
            steps++;
-           Vector neighbours = access.getNeighbours();
+           Vector neighbours = this.m_map.getNeighbours(access);
            for(int i = 0; i < neighbours.size(); i++) {
-               Node neighbour = (Node)neighbours.elementAt(i);
-               if(parents[neighbour.getIndex()] == -1) {
+               int neighbour = ((Integer)neighbours.elementAt(i)).intValue();
+               if(parents[neighbour] == -1) {
                    // not accessed
                    boolean ignore = false;
-                   if(access.getIndex() == start.getIndex()) {
+                   if(access == start) {
                        // start node, check if the neighbour node is in cuts
                        int j = 0;
                        while((!ignore) && (j < cuts.size())) {
                            int tmp = ((Integer)cuts.elementAt(j)).intValue();
-                           if(tmp == neighbour.getIndex()) {
+                           if(tmp == neighbour) {
                                ignore = true;
                            }
                            j++;
                        }
                    }
                    if(!ignore) {
-                       parents[neighbour.getIndex()] = access.getIndex();
-                       toaccess.addElement(neighbour);
+                       parents[neighbour] = access;
+                       toaccess.addElement(new Integer(neighbour));
                    }
                }
            }
index a75ec229ac2d52fb0c90f842d6bf75aa4d819f8a..4afacc75cbd2e2507782a2bd36d72075c9b95fd9 100755 (executable)
@@ -8,7 +8,6 @@ public class Map {
     // maze
     private int m_nrofblocks;
     public int[] m_map;
-    public Node[] m_mapNodes;
     
     // pacmen information
     public int m_nrofpacs;
@@ -36,7 +35,6 @@ public class Map {
        //System.printString("step 1\n");
        this.m_nrofblocks = 15;
        this.m_map = new int[this.m_nrofblocks*this.m_nrofblocks];
-       this.m_mapNodes = new Node[this.m_nrofblocks*this.m_nrofblocks];
        
        this.m_nrofpacs = nrofpacs;
        this.m_pacMenX = new int[this.m_nrofpacs];
@@ -59,7 +57,6 @@ public class Map {
        
        for(int i = 0; i < this.m_nrofblocks*this.m_nrofblocks; i++) {
            this.m_map[i] = -1;
-           this.m_mapNodes[i] = new Node(i%this.m_nrofblocks, i/this.m_nrofblocks, i);
        }
        
        //System.printString("step 2\n");
@@ -93,46 +90,6 @@ public class Map {
        this.m_map[i++]=1;this.m_map[i++]=10;this.m_map[i++]=10;this.m_map[i++]=6;this.m_map[i++]=13;this.m_map[i++]=5;this.m_map[i++]=11;this.m_map[i++]=2;this.m_map[i++]=14;this.m_map[i++]=5;this.m_map[i++]=13;this.m_map[i++]=3;this.m_map[i++]=10;this.m_map[i++]=10;this.m_map[i++]=4;
        this.m_map[i++]=5;this.m_map[i++]=11;this.m_map[i++]=14;this.m_map[i++]=1;this.m_map[i++]=10;this.m_map[i++]=8;this.m_map[i++]=6;this.m_map[i++]=13;this.m_map[i++]=3;this.m_map[i++]=8;this.m_map[i++]=10;this.m_map[i++]=4;this.m_map[i++]=11;this.m_map[i++]=14;this.m_map[i++]=5;
        this.m_map[i++]=9;this.m_map[i++]=10;this.m_map[i++]=10;this.m_map[i++]=12;this.m_map[i++]=3;this.m_map[i++]=6;this.m_map[i++]=9;this.m_map[i++]=10;this.m_map[i++]=12;this.m_map[i++]=3;this.m_map[i++]=6;this.m_map[i++]=9;this.m_map[i++]=10;this.m_map[i++]=10;this.m_map[i++]=12; // 15*15
-       
-       // initilize the graph of the maze
-       for(i = 0; i < this.m_nrofblocks*this.m_nrofblocks; i++) {
-           int tmp = this.m_map[i];
-           Node tmpNode = this.m_mapNodes[i];
-           int locX = tmpNode.getXLoc();
-           int locY = tmpNode.getYLoc();
-           if((int)(tmp & 1) == 0) {
-               // can go left
-               if(locX == 0) {
-                   tmpNode.addNeighbour(this.m_mapNodes[locY * this.m_nrofblocks + this.m_nrofblocks - 1]);
-               } else {
-                   tmpNode.addNeighbour(this.m_mapNodes[i - 1]);
-               }
-           } 
-           if((int)(tmp & 2) == 0) {
-               // can go up
-               if(locY == 0) {
-                   tmpNode.addNeighbour(this.m_mapNodes[(this.m_nrofblocks - 1) * this.m_nrofblocks + locX]);
-               } else {
-                   tmpNode.addNeighbour(this.m_mapNodes[(locY - 1) * this.m_nrofblocks + locX]);
-               }
-           }
-           if((int)(tmp & 4) == 0) {
-               // can go right
-               if(locX == this.m_nrofblocks - 1) {
-                   tmpNode.addNeighbour(this.m_mapNodes[locY * this.m_nrofblocks]);
-               } else {
-                   tmpNode.addNeighbour(this.m_mapNodes[i + 1]);
-               }
-           }
-           if((int)(tmp & 8) == 0) {
-               // can go down
-               if(locY == this.m_nrofblocks - 1) {
-                   tmpNode.addNeighbour(this.m_mapNodes[locX]);
-               } else {
-                   tmpNode.addNeighbour(this.m_mapNodes[(locY + 1) * this.m_nrofblocks + locX]);
-               }
-           }
-       }
     } 
 
     public void placePacman(Pacman t) {
@@ -177,4 +134,44 @@ public class Map {
     public boolean isfinish() {
        return this.m_nrofpacs == 0;
     }
+    
+    public Vector getNeighbours(int index) {
+       Vector neighbours = new Vector();
+       int tmp = this.m_map[index];
+       int locX = index % this.m_nrofblocks;
+       int locY = index / this.m_nrofblocks;
+       if((int)(tmp & 1) == 0) {
+           // can go left
+           if(locX == 0) {
+               neighbours.addElement(new Integer(locY * this.m_nrofblocks + this.m_nrofblocks - 1));
+           } else {
+               neighbours.addElement(new Integer(index - 1));
+           }
+       } 
+       if((int)(tmp & 2) == 0) {
+           // can go up
+           if(locY == 0) {
+               neighbours.addElement(new Integer((this.m_nrofblocks - 1) * this.m_nrofblocks + locX));
+           } else {
+               neighbours.addElement(new Integer((locY - 1) * this.m_nrofblocks + locX));
+           }
+       }
+       if((int)(tmp & 4) == 0) {
+           // can go right
+           if(locX == this.m_nrofblocks - 1) {
+               neighbours.addElement(new Integer(locY * this.m_nrofblocks));
+           } else {
+               neighbours.addElement(new Integer(index + 1));
+           }
+       }
+       if((int)(tmp & 8) == 0) {
+           // can go down
+           if(locY == this.m_nrofblocks - 1) {
+               neighbours.addElement(new Integer(locX));
+           } else {
+               neighbours.addElement(new Integer((locY + 1) * this.m_nrofblocks + locX));
+           }
+       }
+       return neighbours;
+    }
 }
\ No newline at end of file
diff --git a/Robust/src/Benchmarks/MMG/Tag/Node.java b/Robust/src/Benchmarks/MMG/Tag/Node.java
deleted file mode 100644 (file)
index bcc4d3e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-public class Node {
-    
-    int m_locX;
-    int m_locY;
-    int m_index;
-    Vector m_neighbours;
-    
-    public Node(int locX, int locY, int index) {
-       this.m_locX = locX;
-       this.m_locY = locY;
-       this.m_index = index;
-       this.m_neighbours = new Vector();
-    }
-    
-    public void addNeighbour(Node n) {
-       this.m_neighbours.addElement(n);
-    }
-    
-    public Vector getNeighbours() {
-       return this.m_neighbours;
-    }
-    
-    public int getXLoc() {
-       return this.m_locX;
-    }
-    
-    public int getYLoc() {
-       return this.m_locY;
-    }
-    
-    public int getIndex() {
-       return this.m_index;
-    }
-}
\ No newline at end of file
index 651b90dc8e2419c095a107a55cb45a94adb57a6b..2737b80c85289c1f21d1bcf81983e7c01156ee40 100755 (executable)
@@ -38,7 +38,7 @@ public class Pacman {
     
     private void setNextDirection() {
        // current position of the ghost
-       Node start = this.m_map.m_mapNodes[this.m_locY * this.m_map.m_nrofblocks + this.m_locX];
+       int start = this.m_locY * this.m_map.m_nrofblocks + this.m_locX;
        
        // get target's position
        int targetx = this.m_tx;
@@ -47,7 +47,7 @@ public class Pacman {
        nextLocation[0] = nextLocation[1] = -1;
        
        // target's position
-       Node end = this.m_map.m_mapNodes[targety * this.m_map.m_nrofblocks + targetx];
+       int end = targety * this.m_map.m_nrofblocks + targetx;
        
        // breadth-first traverse the graph view of the maze
        // check the shortest path for the start node to the end node
@@ -71,10 +71,10 @@ public class Pacman {
            } else {
                // Reversely go over the parents array to find the next node to reach
                boolean found = false;
-               int index = end.getIndex();
+               int index = end;
                while(!found) {
                    int parent = parents[index];
-                   if(parent == start.getIndex()) {
+                   if(parent == start) {
                        found = true;
                    } else {
                        index = parent;
@@ -82,8 +82,8 @@ public class Pacman {
                }
 
                // set the chase direction
-               int nx = this.m_map.m_mapNodes[index].getXLoc();
-               int ny = this.m_map.m_mapNodes[index].getYLoc();
+               int nx = index % this.m_map.m_nrofblocks;
+               int ny = index / this.m_map.m_nrofblocks;
                this.m_dx = nx - this.m_locX;
                this.m_dy = ny - this.m_locY;
                if(this.m_dx > 0) {
@@ -130,40 +130,40 @@ public class Pacman {
     // Array parents records parent for a node in the BFS search, 
     // the last item of parents records the least steps to reach end node from start node
     // Vector cuts specifies which nodes can not be the first one to access in this BFS
-    private boolean BFS(Node start, Node end, int[] parents, Vector cuts) {
+    private boolean BFS(int start, int end, int[] parents, Vector cuts) {
        int steps = 0;
        Vector toaccess = new Vector();
-       toaccess.addElement(start);
+       toaccess.addElement(new Integer(start));
        while(toaccess.size() > 0) {
            // pull out the first one to access
-           Node access = (Node)toaccess.elementAt(0);
+           int access = ((Integer)toaccess.elementAt(0)).intValue();
            toaccess.removeElementAt(0);
-           if(access.getIndex() == end.getIndex()) {
+           if(access == end) {
                // hit the end node
                parents[parents.length - 1] = steps;
                return true;
            }
            steps++;
-           Vector neighbours = access.getNeighbours();
+           Vector neighbours = this.m_map.getNeighbours(access);
            for(int i = 0; i < neighbours.size(); i++) {
-               Node neighbour = (Node)neighbours.elementAt(i);
-               if(parents[neighbour.getIndex()] == -1) {
+               int neighbour = ((Integer)neighbours.elementAt(i)).intValue();
+               if(parents[neighbour] == -1) {
                    // not accessed
                    boolean ignore = false;
-                   if(access.getIndex() == start.getIndex()) {
+                   if(access == start) {
                        // start node, check if the neighbour node is in cuts
                        int j = 0;
                        while((!ignore) && (j < cuts.size())) {
                            int tmp = ((Integer)cuts.elementAt(j)).intValue();
-                           if(tmp == neighbour.getIndex()) {
+                           if(tmp == neighbour) {
                                ignore = true;
                            }
                            j++;
                        }
                    }
                    if(!ignore) {
-                       parents[neighbour.getIndex()] = access.getIndex();
-                       toaccess.addElement(neighbour);
+                       parents[neighbour] = access;
+                       toaccess.addElement(new Integer(neighbour));
                    }
                }
            }
@@ -195,7 +195,7 @@ public class Pacman {
            locX++;
        }
        steps++; 
-       
+
        boolean set = false;
        // Determine next turning location.
        while (!set) {
@@ -268,9 +268,9 @@ public class Pacman {
        
        // check the least steps for the ghosts to reach point location
        int chasesteps = -1;
-       Node end = this.m_map.m_mapNodes[point[1] * this.m_map.m_nrofblocks + point[0]];
+       int end = point[1] * this.m_map.m_nrofblocks + point[0];
        for(int i = 0; i < this.m_map.m_ghostsX.length; i++) {
-           Node start = this.m_map.m_mapNodes[this.m_map.m_ghostsY[i] * this.m_map.m_nrofblocks + this.m_map.m_ghostsX[i]];
+           int start = this.m_map.m_ghostsY[i] * this.m_map.m_nrofblocks + this.m_map.m_ghostsX[i];
            int parents[] = new int[this.m_map.m_nrofblocks * this.m_map.m_nrofblocks + 1];
            for(int j = 0; j < parents.length; j++) {
                parents[j] = -1;