//public AbdadaTable AbdadaTable { get; }

        public SearchState()
        {
            TranspositionTable      = new TranspositionTable();
            PrincipalVariationTable = new PrincipalVariationTable();
            //AbdadaTable = new AbdadaTable();
            ThreadStates = new ThreadUniqueState[SearchConstants.ThreadCount];
            for (int i = 0; i < ThreadStates.Length; i++)
            {
                ThreadStates[i] = new ThreadUniqueState(i);
            }
            EmptyContinuation = new ContinuationEntry();
        }
        public ThreadUniqueState(int threadId)
        {
            ThreadId = threadId;
            Killers  = new uint[SearchConstants.MaxDepth][]; // Non-captures causing beta cutoffs
            for (int i = 0; i < Killers.Length; i++)
            {
                Killers[i] = new uint[2];
            }

            Killers = new uint[SearchConstants.MaxDepth][]; // Non-captures causing beta cutoffs
            for (int i = 0; i < Killers.Length; i++)
            {
                Killers[i] = new uint[2];
            }

            Countermove = new uint[ChessPiece.Count][];
            for (int i = 0; i < Countermove.Length; i++)
            {
                Countermove[i] = new uint[64];
            }

            History = new int[2][][];
            for (int i = 0; i < History.Length; i++)
            {
                History[i] = new int[64][];
                for (int j = 0; j < History[i].Length; j++)
                {
                    History[i][j] = new int[64];
                }
            }

            AllContinuations = new ContinuationEntry[ChessPiece.Count][];
            for (int i = 0; i < AllContinuations.Length; i++)
            {
                AllContinuations[i] = new ContinuationEntry[64];
                for (var j = 0; j < AllContinuations[i].Length; j++)
                {
                    AllContinuations[i][j] = new ContinuationEntry();
                }
            }

            CurrentContinuations = new ContinuationEntry[4];

            PieceToHistory = new int[ChessPiece.Count][];
            for (int i = 0; i < PieceToHistory.Length; i++)
            {
                PieceToHistory[i] = new int[64];
            }

            CaptureHistory = new int[ChessPiece.Count][][];
            for (int i = 0; i < CaptureHistory.Length; i++)
            {
                CaptureHistory[i] = new int[64][];
                for (int j = 0; j < CaptureHistory[i].Length; j++)
                {
                    CaptureHistory[i][j] = new int[ChessPiece.Count];
                }
            }

            Cutoff = new int[2][][];
            for (int i = 0; i < Cutoff.Length; i++)
            {
                Cutoff[i] = new int[64][];
                for (int j = 0; j < Cutoff[i].Length; j++)
                {
                    Cutoff[i][j] = new int[64];
                }
            }

            Moves = new Move[SearchConstants.MaxDepth][];
            for (int i = 0; i < Moves.Length; i++)
            {
                Moves[i] = new Move[218];
            }

            FailedMoves = new Move[SearchConstants.MaxDepth][];
            for (int i = 0; i < FailedMoves.Length; i++)
            {
                FailedMoves[i] = new Move[218];
            }

            SeeScores = new int[SearchConstants.MaxDepth][];
            for (int i = 0; i < SeeScores.Length; i++)
            {
                SeeScores[i] = new int[218];
            }

            MoveStaticScores = new int[SearchConstants.MaxDepth][];
            for (int i = 0; i < MoveStaticScores.Length; i++)
            {
                MoveStaticScores[i] = new int[218];
            }

            Rng = new Random(threadId);
        }