mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 14:27:35 +00:00
Solitaire: Add stack for the playable cards on top of the waste stack
While the waste stack and the playable card on top of the waste stack are collectively referred to as the "waste", it's programatically nice to separate them to enable 3-card-draw mode. In that mode, the playable stack will contain 3 cards with a slight x-axis shift, while the waste stack underneath will remain unshifted. So rather than introducing some ugly logic to CardStack to handle this, it's more convenient to have a separate stack on top of the waste stack.
This commit is contained in:
parent
d5ea04cdfb
commit
3a45bf5254
4 changed files with 56 additions and 8 deletions
|
@ -18,6 +18,7 @@ public:
|
|||
Stock,
|
||||
Normal,
|
||||
Waste,
|
||||
Play,
|
||||
Foundation
|
||||
};
|
||||
|
||||
|
@ -36,6 +37,7 @@ public:
|
|||
|
||||
void push(NonnullRefPtr<Card> card);
|
||||
NonnullRefPtr<Card> pop();
|
||||
void move_to_stack(CardStack&);
|
||||
void rebound_cards();
|
||||
|
||||
bool is_allowed_to_push(const Card&) const;
|
||||
|
@ -59,8 +61,11 @@ private:
|
|||
case Normal:
|
||||
return { 0, 20, 1, 3 };
|
||||
case Stock:
|
||||
case Waste:
|
||||
return { 2, 1, 8, 1 };
|
||||
case Waste:
|
||||
return { 0, 0, 1, 0 };
|
||||
case Play:
|
||||
return { 20, 0, 1, 0 };
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue