aboutsummaryrefslogtreecommitdiff
path: root/exp/functions.go
diff options
context:
space:
mode:
Diffstat (limited to 'exp/functions.go')
-rw-r--r--exp/functions.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/exp/functions.go b/exp/functions.go
index da535c4..c69ef26 100644
--- a/exp/functions.go
+++ b/exp/functions.go
@@ -3,6 +3,7 @@ package exp
import (
"github.com/anhgelus/gokord"
"math"
+ "slices"
)
func MessageXP(length uint, diversity uint) uint {
@@ -11,6 +12,16 @@ func MessageXP(length uint, diversity uint) uint {
))
}
+func CalcDiversity(msg string) uint {
+ var chars []rune
+ for _, c := range []rune(msg) {
+ if !slices.Contains(chars, c) {
+ chars = append(chars, c)
+ }
+ }
+ return uint(len(chars))
+}
+
func VocalXP(time uint) uint {
return uint(math.Floor(
0.01*math.Pow(float64(time), 1.3) + 1,