// Requires go get github.com/holizz/terrapin package main import ( "fmt" "github.com/holizz/terrapin" "image" "image/png" "math" "net/http" ) func kochCurve(t *terrapin.Terrapin, lung float64, liv int) { if liv == 0 { t.Forward(lung) } else { kochCurve(t, lung, liv-1) t.Left(math.Pi / 3.0) kochCurve(t, lung, liv-1) t.Right(2.0 * math.Pi / 3.0) kochCurve(t, lung, liv-1) t.Left(math.Pi / 3.0) kochCurve(t, lung, liv-1) } } func kochSnowflake(t *terrapin.Terrapin, lung float64, liv int) { kochCurve(t, lung, liv) t.Right(2.0 * math.Pi / 3.0) kochCurve(t, lung, liv) t.Right(2.0 * math.Pi / 3.0) kochCurve(t, lung, liv) t.Right(2.0 * math.Pi / 3.0) } func pageMain(w http.ResponseWriter, r *http.Request) { w.Write([]byte(`