mirror of
https://github.com/milimoe/FunGame-Testing.git
synced 2025-12-05 00:06:05 +00:00
修复赛马BUG,添加共斗
This commit is contained in:
parent
4cfc56df38
commit
6299259b96
@ -10,19 +10,32 @@ namespace Milimoe.FunGame.Testing.Tests
|
||||
public static void HorseTest1()
|
||||
{
|
||||
List<string> msgs = [];
|
||||
while (true)
|
||||
{
|
||||
Room room = Factory.GetRoom(1, "1", gameMap: "1");
|
||||
room.Name = "赛马房间";
|
||||
for (int i = 0; i < 5; i++)
|
||||
Dictionary<User, int> points = [];
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
User user = Factory.GetUser();
|
||||
user.Id = i;
|
||||
user.Username = FunGameService.GenerateRandomChineseUserName();
|
||||
room.UserAndIsReady.Add(user, true);
|
||||
points[user] = 0;
|
||||
if (i == 0) room.RoomMaster = user;
|
||||
}
|
||||
HorseRacing.RunHorseRacing(msgs, room);
|
||||
int plays = 0;
|
||||
while (true)
|
||||
{
|
||||
plays++;
|
||||
Dictionary<long, int> racingPoints = HorseRacing.RunHorseRacing(msgs, room);
|
||||
foreach (long userId in racingPoints.Keys)
|
||||
{
|
||||
if (points.Keys.FirstOrDefault(u => u.Id == userId) is User user)
|
||||
{
|
||||
points[user] += racingPoints[userId];
|
||||
}
|
||||
}
|
||||
Console.WriteLine(string.Join("\r\n", msgs));
|
||||
Console.WriteLine($"\r\n====赛马积分排行榜====\r\n比赛场次:{plays} 场\r\n" + string.Join("\r\n", points.OrderByDescending(kv => kv.Value).Select((kv, index) => (index + 1) + ". " + kv.Key + ":" + kv.Value + " 分")));
|
||||
if (Console.ReadKey().Key == ConsoleKey.Escape)
|
||||
{
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user