Chess Challenge Project

This commit is contained in:
Sebastian Lague 2023-07-21 14:16:37 +02:00
parent 29e522df30
commit a268bc3cad
60 changed files with 7316 additions and 0 deletions

View file

@ -0,0 +1,44 @@
using Raylib_cs;
using System.Numerics;
using System;
namespace ChessChallenge.Application
{
public static class MatchStatsUI
{
public static void DrawMatchStats(ChallengeController controller)
{
if (controller.PlayerWhite.IsBot && controller.PlayerBlack.IsBot)
{
int nameFontSize = UIHelper.ScaleInt(40);
int regularFontSize = UIHelper.ScaleInt(35);
int headerFontSize = UIHelper.ScaleInt(45);
Color col = new(180, 180, 180, 255);
Vector2 startPos = UIHelper.Scale(new Vector2(1500, 250));
float spacingY = UIHelper.Scale(35);
DrawNextText($"Game {controller.CurrGameNumber} of {controller.TotalGameCount}", headerFontSize, Color.WHITE);
startPos.Y += spacingY * 2;
DrawStats(controller.BotStatsA);
startPos.Y += spacingY * 2;
DrawStats(controller.BotStatsB);
void DrawStats(ChallengeController.BotMatchStats stats)
{
DrawNextText(stats.BotName + ":", nameFontSize, Color.WHITE);
DrawNextText($"Score: +{stats.NumWins} ={stats.NumDraws} -{stats.NumLosses}", regularFontSize, col);
DrawNextText($"Num Timeouts: {stats.NumTimeouts}", regularFontSize, col);
DrawNextText($"Num Illegal Moves: {stats.NumIllegalMoves}", regularFontSize, col);
}
void DrawNextText(string text, int fontSize, Color col)
{
UIHelper.DrawText(text, startPos, fontSize, 1, col);
startPos.Y += spacingY;
}
}
}
}
}