// initializes a new maze and places Icarus in his awakening location func GetStartingPoint(c *gin.Context) { initializeMaze() startRoom, err := currentMaze.Discover(currentMaze.Icarus()) if err != nil { fmt.Println("Icarus is outside of the maze. This shouldn't ever happen") fmt.Println(err) os.Exit(-1) } mazelib.PrintMaze(currentMaze) c.JSON(http.StatusOK, mazelib.Reply{Survey: startRoom}) }
package commands import ( "github.com/fwip/gc6/mazelib" "github.com/spf13/cobra" ) var printMazeCmd = &cobra.Command{ Use: "printmaze", Aliases: []string{"generate"}, Short: "Generate and print a maze", Long: `Daedalus generates a maze, prints it, then exits`, Run: func(cmd *cobra.Command, args []string) { mazelib.PrintMaze(createMaze()) }, } func init() { RootCmd.AddCommand(printMazeCmd) }