123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- #ifndef DECK_H
- #define DECK_H
- #include "door.h"
- #include <memory>
- #include <random>
- #include <string>
- #include <utility> // pair
- #include <vector>
- typedef std::vector<int> cards;
- typedef std::shared_ptr<door::Panel> shared_panel;
- class Deck {
- private:
-
- door::ANSIColor card_back_color;
- vector<door::Panel *> cards;
- vector<door::Panel *> backs;
- vector<door::Panel *> mark;
- door::Panel *cardOf(int c);
- std::string backSymbol(int level);
- door::Panel *backOf(int level);
- door::Panel *markOf(int c);
- char rankSymbol(int c);
- std::string suitSymbol(int c);
- const int card_height = 3;
- public:
- enum SUIT { HEART, DIAMOND, CLUBS, SPADE };
- const static std::array<std::pair<int, int>, 18> blocks;
- Deck(door::ANSIColor backcolor = door::ANSIColor(door::COLOR::RED));
- Deck(Deck &&);
- Deck &operator=(Deck &&);
- ~Deck();
- int getRank(int c);
- int getSuit(int c);
- int getDeck(int c);
- bool canPlay(int card1, int card2);
- door::Panel *card(int c);
- door::Panel *back(int level);
- door::Panel *marker(int c);
- std::vector<int> unblocks(int card);
- void removeCard(door::Door &door, int c, int off_x, int off_y, bool left,
- bool right);
- };
- void cardPos(int pos, int &x, int &y);
- void cardLevel(int pos, int &level);
- void cardPosLevel(int pos, int &x, int &y, int &level);
- cards shuffleCards(std::seed_seq &seed, int decks = 1);
- cards makeCardStates(int decks = 1);
- int findNextActiveCard(bool left, const cards &states, int current);
- int findClosestActiveCard(const cards &states, int current);
- extern vector<std::string> deck_colors;
- door::renderFunction makeColorRender(door::ANSIColor c1, door::ANSIColor c2,
- door::ANSIColor c3);
- door::ANSIColor stringToANSIColor(std::string colorCode);
- std::string stringFromColorOptions(int opt);
- void string_toupper(std::string &str);
- #endif
|