public void Reset() { _debugTag = null; _mode = UsageMode.None; _continuationState.Clear(); _writeToken = default(WriteToken); _writer.Reset(); _cacheItem.Reset(); }
/// <inheritdoc/> public override void Clear() { if (_stack.Count > 0) // Check to avoid unnecessary locking. { lock (_stack) { _stack.Clear(); } } }
public void SetDefaultState() { Pieces[Color.White][Piece.Pawn] = 65280; Pieces[Color.White][Piece.Rook] = 129; Pieces[Color.White][Piece.Knight] = 66; Pieces[Color.White][Piece.Bishop] = 36; Pieces[Color.White][Piece.Queen] = 16; Pieces[Color.White][Piece.King] = 8; Pieces[Color.Black][Piece.Pawn] = 71776119061217280; Pieces[Color.Black][Piece.Rook] = 9295429630892703744; Pieces[Color.Black][Piece.Knight] = 4755801206503243776; Pieces[Color.Black][Piece.Bishop] = 2594073385365405696; Pieces[Color.Black][Piece.Queen] = 1152921504606846976; Pieces[Color.Black][Piece.King] = 576460752303423488; Occupancy[Color.White] = 65535; Occupancy[Color.Black] = 18446462598732840960; OccupancySummary = Occupancy[Color.White] | Occupancy[Color.Black]; EnPassant = 0; Castling = Castling.Everything; ColorToMove = Color.White; MovesCount = 0; IrreversibleMovesCount = 0; NullMoves = 0; CastlingDone[Color.White] = false; CastlingDone[Color.Black] = false; Material[Color.White] = CalculateMaterial(Color.White); Material[Color.Black] = CalculateMaterial(Color.Black); Position[Color.White][GamePhase.Opening] = CalculatePosition(Color.White, GamePhase.Opening); Position[Color.White][GamePhase.Ending] = CalculatePosition(Color.White, GamePhase.Ending); Position[Color.Black][GamePhase.Opening] = CalculatePosition(Color.Black, GamePhase.Opening); Position[Color.Black][GamePhase.Ending] = CalculatePosition(Color.Black, GamePhase.Ending); Array.Fill(PieceTable, -1); CalculatePieceTable(PieceTable); Hash = ZobristHashing.CalculateHash(this); PawnHash = ZobristHashing.CalculatePawnHash(this); MaterialAtOpening = CalculateMaterialAtOpening(); _killedPieces.Clear(); _enPassants.Clear(); _castlings.Clear(); _promotedPieces.Clear(); _hashes.Clear(); _pawnHashes.Clear(); _irreversibleMovesCounts.Clear(); }
public void Reset(object root) { if (_currentStateBuffer != null) { _ctx.ReturnMemory(_currentStateBuffer); _currentStateBuffer = null; } _elements.Clear(); _seenValues.Clear(); if (root != null) { _elements.Push(root); } }
public void StepAll(float dt) { for (int i = 0; i < ActiveIndices.Top; i++) { if (Active[i](dt) == RuleResult.Done) { ActiveSlots[i] = false; } else { SupportStack.Push(i); } } ActiveIndices.Clear(); var tmp = SupportStack; SupportStack = ActiveIndices; ActiveIndices = tmp; }
public void Reset(object root) { _seenIndex = ++ThreadLocalSeenIndex; if (ThreadLocalSeenIndex > short.MaxValue) { ThreadLocalSeenIndex = 1; } if (_currentStateBuffer != null) { _ctx.ReturnMemory(_currentStateBuffer); _currentStateBuffer = null; } _elements.Clear(); if (root != null) { _elements.Push(root); } }