예제 #1
0
파일: daedalus.go 프로젝트: fwip/gc6
// 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})
}
예제 #2
0
파일: printmaze.go 프로젝트: fwip/gc6
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)
}