示例#1
0
func solveHandler(w http.ResponseWriter, r *http.Request) {
	robots := new([4][2]uint)
	for i := 0; i < 4; i++ {
		fmt.Sscanf(r.FormValue(fmt.Sprintf("robot%v", i+1)),
			"%v_%v", &robots[i][0], &robots[i][1])
	}
	var tx, ty uint
	fmt.Sscanf(r.FormValue("target"), "%v_%v", &tx, &ty)
	b := core.StandardBoard().Reset(robots)
	p := core.NewPosition(b, b.Location(tx, ty))
	fmt.Fprintf(w, solve(p, robots, appengine.NewContext(r)))
}
示例#2
0
func mainHandler(w http.ResponseWriter, r *http.Request) {
	mainTemplate.Execute(w, board(core.StandardBoard()))
}