/// <summary> /// Adds a child node to this node. /// </summary> /// <param name="move"></param> /// <param name="activeIndex"></param> /// <returns>A new child node.</returns> internal TreeNode AddChild(Move move, int activeIndex) { var child = new TreeNode { Move = move, ActiveIndex = activeIndex, Parent = this }; if (FirstChild == null) { FirstChild = child; LastChild = child; } else { LastChild.NextSibling = child; LastChild = child; } return child; }
internal void DoMove(Move move) { // Register the move. ActiveHand.Move = move; // Remove the played card from the player's cards. ActiveHand.Cards &= ~move.Card; // Update the leading suit. if (mLeadingSuit == 0) mLeadingSuit = BitwiseCardHelper.GetSuitAsBits(move.Card); ActivateNextHand(); // If the next player has already played a card, then the trick is over. if (ActiveHand.Move.Card != 0) { mActiveIndex = GetTrickWinner(); ActiveHand.Tricks++; for (int i = 0; i < HandCount; i++) { mDiscards |= mHands[i].Move.Card; mHands[i].Move = Move.Empty; } mLeadingSuit = 0; } }