From 5af6bd672c342fc4e7c4cc7bf61efd5026433ead Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Tue, 13 May 2025 13:19:59 +0200 Subject: style(event): move calcdiversity in exp --- exp/functions.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'exp/functions.go') 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, -- cgit v1.2.3