package edu.uabc.ai.p1;

import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.ArrayList;

import edu.uabc.ai.search.*;
import edu.uabc.util.StringUtil;

public class App {
    private static final String CITIES[] = new String[] {
        "A", "B", "C", "D", "E", "F", "G", "H", "I"
    };

    private static final List<String[]> CONNECTIONS= new ArrayList<String[]>() {{
        add(new String[] {"A", "B", "E", "H", "I"});
        add(new String[] {"A", "C", "D", "H", "I"});
        add(new String[] {"A", "D", "H", "I"});
        add(new String[] {"A", "E", "F", "I"});
        add(new String[] {"A", "E", "G", "I"});
        add(new String[] {"A", "D", "I"});
        add(new String[] {"A", "H", "I"});
    }};

    public static void main(String args[]) {
        Problem world= new World(CITIES, CONNECTIONS, "A");

        Search search= new Search(world, new State("I"));
        State path[]= search.solve();
        
        System.out.println("Solving...");
        System.out.println("Solution: "  + StringUtil.join(" -> ", path));
    }
}

@@ -147,16 +147,105 @@
 arch.*;%0A
+import static edu.uabc.ai.search.State.S;%0Aimport static edu.uabc.ai.search.State.States;%0A
 import e
@@ -578,19 +578,14 @@
 %22, %22
-C
+E
 %22, %22
-D%22, %22H
+G
 %22, %22
@@ -626,14 +626,14 @@
 %22, %22
-D
+C
 %22, %22
-H
+E
 %22, %22
@@ -666,30 +666,25 @@
 ng%5B%5D %7B%22A%22, %22
-E%22, %22F
+D
 %22, %22I%22%7D);%0A  
@@ -689,134 +689,478 @@
     
-    add(new String%5B%5D %7B%22A%22, %22E%22, %22G%22, %22I%22%7D);%0A        add(new String%5B%5D %7B%22A%22, %22D%22, %22I%22%7D);%0A        add(new String%5B%5D %7B%22A%22, 
+%7D%7D;%0A%0A    private static final Map%3CState%5B%5D, Integer%3E COSTS= new HashMap%3CState%5B%5D, Integer%3E()%7B%7B%0A        put(States(%22A%22, %22B%22), 50);%0A        put(States(%22A%22, %22C%22), 20);%0A        put(States(%22A%22, %22D%22), 50);%0A        put(States(%22A%22, %22E%22), 50);%0A        put(States(%22B%22, %22C%22), 35);%0A        put(States(%22C%22, %22D%22), 35);%0A        put(States(%22D%22, %22E%22), 40);%0A        put(States(%22E%22, %22F%22), 60);%0A        put(States(%22F%22, %22G%22), 25);%0A        put(States(%22G%22, %22H%22), 50);%0A        put(States(
 %22H%22, %22I%22
 %7D);%0A
@@ -1151,25 +1151,29 @@
 tes(%22H%22, %22I%22
-%7D
+), 70
 );%0A    %7D%7D;%0A%0A
@@ -1257,16 +1257,21 @@
 (CITIES,
+ %22A%22,
  CONNECT
@@ -1276,19 +1276,21 @@
 CTIONS, 
-%22A%22
+COSTS
 );%0A%0A    

Set the costs for the paths in p2