コード例 #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)
}