< Summary

Information
Class: Rudim.Common.GamePhase
Assembly: Rudim
File(s): /home/runner/work/rudim/rudim/Rudim/Common/GamePhase.cs
Line coverage
100%
Covered lines: 7
Uncovered lines: 0
Coverable lines: 7
Total lines: 28
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%
AddPhase(...)100%11100%
RemovePhase(...)100%11100%

File(s)

/home/runner/work/rudim/rudim/Rudim/Common/GamePhase.cs

#LineLine coverage
 1namespace Rudim.Common
 2{
 3    public static class GamePhase
 4    {
 5        private static readonly int[] PieceConstants;
 6        public static readonly int TotalPhase;
 7        public static readonly double PhaseFactor;
 8        public static readonly int OnlyPawns;
 9
 10        static GamePhase()
 11        {
 112            PieceConstants = [0, 1, 1, 2, 4, 0];
 113            TotalPhase = PieceConstants[(int)Piece.Pawn] * 16 + PieceConstants[(int)Piece.Knight] * 4 + PieceConstants[(
 114            OnlyPawns = PieceConstants[(int)Piece.Pawn] * 16;
 115            PhaseFactor = 1 / (double)TotalPhase;
 116        }
 17
 18        public static int AddPhase(int phase, Piece piece)
 19        {
 1510158120            return phase + PieceConstants[(int)piece];
 21        }
 22
 23        public static int RemovePhase(int phase, Piece piece)
 24        {
 1509988525            return phase - PieceConstants[(int)piece];
 26        }
 27    }
 28}