mirror of
https://github.com/kierankihn/uno-game.git
synced 2025-12-27 02:13:18 +08:00
feat(game): add getFront and front for DiscardTile
This commit is contained in:
@@ -39,6 +39,11 @@ namespace UNO::GAME {
|
||||
return card;
|
||||
}
|
||||
|
||||
Card CardTile::front() const
|
||||
{
|
||||
return cards_.front();
|
||||
}
|
||||
|
||||
bool CardTile::isEmpty() const
|
||||
{
|
||||
return cards_.empty();
|
||||
@@ -63,6 +68,11 @@ namespace UNO::GAME {
|
||||
this->pushFront(card);
|
||||
}
|
||||
|
||||
Card DiscardPile::getFront()
|
||||
{
|
||||
return this->front();
|
||||
}
|
||||
|
||||
Deck::Deck() = default;
|
||||
|
||||
void Deck::init()
|
||||
|
||||
@@ -48,6 +48,11 @@ namespace UNO::GAME {
|
||||
*/
|
||||
Card popBack();
|
||||
|
||||
/**
|
||||
* @return 牌堆中最上方的牌
|
||||
*/
|
||||
[[nodiscard]] Card front() const;
|
||||
|
||||
/**
|
||||
* @return 牌堆是否为空
|
||||
*/
|
||||
@@ -78,6 +83,11 @@ namespace UNO::GAME {
|
||||
* 向弃牌堆中添加 @param card 卡牌
|
||||
*/
|
||||
void add(Card card);
|
||||
|
||||
/**
|
||||
* @return 牌堆中最上方的牌
|
||||
*/
|
||||
Card getFront();
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user