Ohhhh
This commit is contained in:
parent
5d46f98cb4
commit
d3b5d2c37f
@ -17,14 +17,16 @@ func Start(config Config) {
|
|||||||
|
|
||||||
repo := repo.NewInMemoryRepo()
|
repo := repo.NewInMemoryRepo()
|
||||||
|
|
||||||
loadFromFile(repo, "./data.json")
|
controller := newController(repo)
|
||||||
|
|
||||||
|
loadFromFile(controller, "./data.json")
|
||||||
|
|
||||||
mux := web.CreateWebserver(repo)
|
mux := web.CreateWebserver(repo)
|
||||||
|
|
||||||
http.ListenAndServe(":8080", mux)
|
http.ListenAndServe(":8080", mux)
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadFromFile(repo repo.Repo, path string) error {
|
func loadFromFile(c Controller, path string) error {
|
||||||
content, err := os.ReadFile(path)
|
content, err := os.ReadFile(path)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -38,7 +40,7 @@ func loadFromFile(repo repo.Repo, path string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, game := range payload {
|
for _, game := range payload {
|
||||||
repo.AddGame(game)
|
c.AddGame(game)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package beerpongelo
|
package beerpongelo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"math"
|
"math"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -43,7 +42,6 @@ func NewRating(t0p0, t0p1, t1p0, t1p1 float64, score int) (float64, float64, flo
|
|||||||
}
|
}
|
||||||
|
|
||||||
scoreMod := SCORE_SCALE * math.Log(math.Abs(float64(score))+SCORE_BIAS) / (math.Log(MAX_SCORE) + SCORE_BIAS)
|
scoreMod := SCORE_SCALE * math.Log(math.Abs(float64(score))+SCORE_BIAS) / (math.Log(MAX_SCORE) + SCORE_BIAS)
|
||||||
fmt.Printf("%d: %f\n", score, scoreMod)
|
|
||||||
|
|
||||||
newt0p0 := t0p0 + K*scoreMod*((st0*ct0p0)-(et0*ct0p0))
|
newt0p0 := t0p0 + K*scoreMod*((st0*ct0p0)-(et0*ct0p0))
|
||||||
newt0p1 := t0p1 + K*scoreMod*((st0*ct0p1)-(et0*ct0p1))
|
newt0p1 := t0p1 + K*scoreMod*((st0*ct0p1)-(et0*ct0p1))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user