diff options
| author | Anhgelus Morhtuuzh <anhgelus@anhgelus.world> | 2025-05-13 13:19:59 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <anhgelus@anhgelus.world> | 2025-05-13 13:19:59 +0200 |
| commit | 5af6bd672c342fc4e7c4cc7bf61efd5026433ead (patch) | |
| tree | 4bdb2edff1912d835f97af52b404ad0a8b473c8c /exp/functions.go | |
| parent | 6b6c775ab3af659e26f0c79dbabd86d88d2451d5 (diff) | |
style(event): move calcdiversity in exp
Diffstat (limited to 'exp/functions.go')
| -rw-r--r-- | exp/functions.go | 11 |
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, |
