Start on Implementing PIPs

This commit is contained in:
Rakeela
2024-09-27 21:56:13 -07:00
parent 18b221d972
commit 16f452b08f
3 changed files with 598 additions and 911 deletions

View File

@ -1,6 +1,10 @@
package koboldsim
import "math"
import (
"math"
"golang.org/x/exp/constraints"
)
// Generic helper functions not directly attached to Card Sim Engine mechanics.
@ -20,3 +24,13 @@ func Mean(vals ...float64) float64 {
}
return total / float64(len(vals))
}
func clamp[T constraints.Ordered](val, low, high T) T {
if val < low {
return low
}
if val > high {
return high
}
return val
}