示例#1
0
void Table::addToStacks(Card card) {
	if (!isLegalCard(card)) return;
	int suit = card.getSuit();
	if (stacks_[suit].size() > 0 && card.getRank() < stacks_[suit][0]) {
		// std::cout << "insert";
		stacks_[suit].insert(stacks_[suit].begin(), card.getRank());
	}
	else {
		stacks_[suit].push_back(card.getRank());
	}
	updateLegalCards(card);
}
示例#2
0
void Table::addToStacks(Card card) {
	if (!isLegalCard(card)) return;  //guard
	int suit = card.getSuit();

	//determines if adding to front or back of stack
	if (stacks_[suit].size() > 0 && card.getRank() < stacks_[suit][0]) {
		stacks_[suit].insert(stacks_[suit].begin(), card.getRank());
	}
	else {
		stacks_[suit].push_back(card.getRank());
	}
	updateLegalCards(card);
}