< Summary

Information
Class: Rudim.CLI.UCI.TimeManagement
Assembly: Rudim
File(s): /home/runner/work/rudim/rudim/Rudim/CLI/UCI/TimeManagement.cs
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 16
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
CalculateMoveTime(...)100%11100%

File(s)

/home/runner/work/rudim/rudim/Rudim/CLI/UCI/TimeManagement.cs

#LineLine coverage
 1using Rudim.Common;
 2using System;
 3
 4namespace Rudim.CLI.UCI
 5{
 6    public static class TimeManagement
 7    {
 8        //               Move Number  0 -  10    20   30    40    50   60+
 19        private static readonly double[] Ratios = [0.1, 0.2, 0.375, 0.275, 0.175, 0.1];
 10        public static int CalculateMoveTime(int moveNumber, int clock, int increment)
 11        {
 280012            double moveTime = clock * Ratios[Math.Min(moveNumber / 20, 5)] / 10 + increment - Constants.BufferTime;
 280013            return (int)Math.Max(moveTime, 10);
 14        }
 15    }
 16}