想想一款游戏,玩家们都在努力解决问题,而每一个问题实际上都意味着“关卡”。
玩家在玩游戏时会看到实时排名。
RedisIO 有 sorted set 功能,我会用它。
但我不知道如何给球员打分:
PlayerA at 7 level, total game time 80 seconds
PlayerB at 7 level, total game time 65 seconds
PlayerC at 5 level, total game time 40 seconds
PlayerD at 1 level, total game time 200 seconds
我想要的排名就是这样
1) PlayerB - because level 7 and 65 seconds
2) PlayerA - because level 7 and 80 seconds
3) PlayerC - because level 5 and 40 seconds
4) PlayerD - because level 1 and 200 seconds
我试过了
(timeSpent/level)
计算,但是当某人的水平较低且花费的时间少于其他玩家时,它就无法正常工作。