上传竞技场积分公式代码

This commit is contained in:
liwei1dao 2024-02-01 10:21:00 +08:00
parent 1788e4bd5f
commit 7546c87ff4
2 changed files with 19 additions and 4 deletions

View File

@ -408,13 +408,13 @@ func (this *modelArena) integralCompute(red, bule *pb.ArenaPlayer, iswin bool) {
return
}
if iswin {
red.Changeintegral = int32(redactive.KValue * float32(1-1/float32(1+10^((bule.Integral-red.Integral)/400))))
bule.Changeintegral = int32(buleactive.KValue * float32(0-1/float32(1+10^((red.Integral-bule.Integral)/400))))
red.Changeintegral = int32(float64(redactive.KValue) * float64(1-1/float32(1+math.Pow(10, float64(float64(bule.Integral-red.Integral)/400)))))
bule.Changeintegral = int32(float64(buleactive.KValue) * float64(0-1/float64(1+math.Pow(10, float64(float64(red.Integral-bule.Integral))/400))))
red.Integral = red.Integral + red.Changeintegral
bule.Integral = bule.Integral + bule.Changeintegral
} else {
red.Changeintegral = int32(redactive.KValue * float32(0-1/float32(1+10^((bule.Integral-red.Integral)/400))))
bule.Changeintegral = int32(redactive.KValue * float32(1-1/float32(1+10^((red.Integral-bule.Integral)/400))))
red.Changeintegral = int32(float64(redactive.KValue) * float64(0-1/float64(1+math.Pow(10, float64(float64(bule.Integral-red.Integral)/400)))))
bule.Changeintegral = int32(float64(redactive.KValue) * float64(1-1/float64(1+math.Pow(10, float64(float64(red.Integral-bule.Integral)/400)))))
red.Integral = red.Integral + red.Changeintegral
bule.Integral = bule.Integral + bule.Changeintegral
}

View File

@ -9,6 +9,7 @@ import (
"go_dreamfactory/lego/sys/mgo"
r "go_dreamfactory/lego/sys/redis"
"go_dreamfactory/pb"
"math"
"math/rand"
"sync"
"testing"
@ -163,3 +164,17 @@ func TestUpdateMany(t *testing.T) {
}
}
}
func Test_Area(t *testing.T) {
var (
k int32 = 30
red int32 = 110
bule int32 = 375
)
temp := float64(1 - 1/float32(1+float64(math.Pow(10, float64(float64(bule-red)/400)))))
fmt.Println(temp)
redChangeintegral := int32(float64(k) * temp)
fmt.Println(redChangeintegral)
// red.Changeintegral = int32(redactive.KValue * float32(1-1/float32(1+10^((bule.Integral-red.Integral)/400))))
// bule.Changeintegral = int32(buleactive.KValue * float32(0-1/float32(1+10^((red.Integral-bule.Integral)/400))))
}