Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoWQ222 committed May 8, 2024
1 parent 30b3530 commit aefc7c9
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions logic/Server/GameServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ protected double[] PullScore(double[] scores)
else
{
double[] final = LadderCalculate(org, scores);
final[0] -= org[0];
final[1] -= org[1];
return final;
}
}
Expand All @@ -164,8 +162,11 @@ protected static double[] LadderCalculate(double[] oriScores, double[] competiti
else if (competitionScores[0] == competitionScores[1])// 平局
{
if (oriScores[0] == oriScores[1])
// 完全平局,不改变天梯分数
return oriScores;
// 完全平局,不改变天梯分数
{
double[] Score = [0, 0];
return Score;
}
if (oriScores[0] > oriScores[1])
// 本次游戏平局,但一方天梯分数高,另一方天梯分数低,
// 需要将两者向中间略微靠拢,因此天梯分数低的定为获胜者
Expand All @@ -177,11 +178,11 @@ protected static double[] LadderCalculate(double[] oriScores, double[] competiti
(oriScores[0], oriScores[1]) = (oriScores[1], oriScores[0]);
}

const double normalDeltaThereshold = 1000.0; // 分数差标准化参数,同时也是大分数差阈值
const double normalDeltaThereshold = 2000.0; // 分数差标准化参数,同时也是大分数差阈值
const double correctParam = normalDeltaThereshold * 1.2;// 修正参数
const double winnerWeight = 9e-6; // 获胜者天梯得分权值
const double loserWeight = 5e-6; // 落败者天梯得分权值
const double scoreDeltaThereshold = 2100.0; // 极大分数差阈值
const double winnerWeight = 9e-8; // 获胜者天梯得分权值
const double loserWeight = 5e-8; // 落败者天梯得分权值
const double scoreDeltaThereshold = 40000.0; // 极大分数差阈值

double[] resScore = [0, 0];
double oriDelta = oriScores[0] - oriScores[1]; // 原分数差
Expand All @@ -191,11 +192,11 @@ protected static double[] LadderCalculate(double[] oriScores, double[] competiti
double correct = 0.5 * (Math.Tanh((competitionDelta - scoreDeltaThereshold) / scoreDeltaThereshold
- correctRate)
+ 1.0); // 分数修正
resScore[0] = oriScores[0] + Math.Round(Math.Pow(competitionScores[0], 2)
resScore[0] = Math.Round(Math.Pow(competitionScores[0], 2)
* winnerWeight
* (1 - Math.Tanh(normalOriDelta))
* correct); // 胜者所加天梯分
resScore[1] = oriScores[1] - Math.Round(Math.Pow(competitionDelta, 2)
resScore[1] = -Math.Round(Math.Pow(competitionDelta, 2)
* loserWeight
* (1 - Math.Tanh(normalOriDelta))
* correct); // 败者所扣天梯分
Expand Down

0 comments on commit aefc7c9

Please sign in to comment.