private void RefreshPathsFeature(IBoardState <ChessPieceEntity> boardState, Colours currentPlayer) { if (FeatureFlags.CachingPaths) { // Need proper boardstate key I think, currently a few tests fail, I guess around some state related // so something not encoded in the textboard (enpassant and castle viability namely) var stateKey = ChessGameConvert.SerialiseBoard(boardState); if (_stateCache.TryGetValue(stateKey, out var items)) { boardState.UpdatePaths(items); } else { RefreshChessPaths(boardState, currentPlayer); if (FeatureFlags.CachingPaths) { _stateCache.Add(stateKey, boardState.GetItems().ToArray()); } } } else { RefreshChessPaths(boardState, currentPlayer); } }