package main import ( "flag" // "fmt" "log" "github.com/goccy/go-graphviz" _ "github.com/mattn/go-sqlite3" ) func main() { var ( mapDB string ) flag.StringVar(&mapDB, "map", "Aardwolf.db", "name of aardwolf map file") flag.Parse() am, err := NewMapper(mapDB) if err != nil { log.Fatalf("error creating AardMapper: %s\n", err) } // log.Printf("databse opened: %#+v\n", am) gv := graphviz.New() if err != nil { log.Fatalf("error opening graph: %s\n", err) } g, err := gv.Graph() if err != nil { log.Fatalf("error retrieving cgraph: %s\n", err) } /* x, err := am.Room("673") if err != nil { log.Fatalf("error querying room: %s", err) } log.Printf("%#+v\n", x) return */ rooms, err := am.Rooms() log.Printf("rooms found: %d\n", len(rooms)) for _, room := range rooms[:50] { log.Printf("main() %s\n", room) // log.Printf("Area: %#+v\n", v) // log.Printf("RoomExit found: %s\n", v) err := am.Walk(room.Uid.String, g) if err != nil { log.Fatalf("error adding room to graph: %s\n", err) } } log.Printf("exit count: %d\n", g.NumberEdges()) log.Printf("room count: %d\n", g.NumberNodes()) if err := gv.RenderFilename(g, graphviz.SVG, "/var/www/renders.ndumas.com/aardmaps/final.svg"); err != nil { log.Fatal(err) } // now that I have areas and rooms, I can start building a map // first iteration should be a recursive walk // step over every room. add a vertex, then descend into each // adjoining room }