Exemplo n.º 1
0
func (session *susenSession) solverHandler(w http.ResponseWriter, r *http.Request) {
	curpuz := session.steps[len(session.steps)-1]
	state := curpuz.State()
	body := client.SolverPage(session.sessionID, session.puzzleID, state)
	hs := w.Header()
	hs.Add("Content-Type", "text/html; charset=utf-8")
	w.WriteHeader(http.StatusOK)
	w.Write([]byte(body))
}
Exemplo n.º 2
0
func (s *session) solverHandler(w http.ResponseWriter, r *http.Request) {
	summary, err := s.puzzle().Summary()
	if err != nil {
		panic(fmt.Errorf("Failed to create summary for puzzle: %v", err))
	}
	body := client.SolverPage(s.sid, s.ss.Info, summary.Values)
	hs := w.Header()
	hs.Add("Content-Type", "text/html; charset=utf-8")
	w.WriteHeader(http.StatusOK)
	w.Write([]byte(body))
	log.Printf("Returned solver page for %s:%q step %d.", s.sid, s.name(), s.step())
}