Skip to content

Instantly share code, notes, and snippets.

@i8degrees
Last active December 15, 2015 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save i8degrees/5318675 to your computer and use it in GitHub Desktop.
Save i8degrees/5318675 to your computer and use it in GitHub Desktop.
Final Draft of TTcards Card Objects Design
class Card
{
unsigned int id;
unsigned int level; // 1..10
unsigned int type;
unsigned int element;
unsigned int power[4]; // clockwise; top, right, down, left
std::string name;
// Card ( id, level, type, element, power[], name );
// getID();
// getLevel();
// getType();
// getElement();
// getRank();
// getName();
};
class CardFace
{
public:
// CardFace ( Card *card );
// draw ( int x, int y, SDL_Surface *video_buffer );
// bool flipCard ();
private:
int id;
int x;
int y;
int w = CARD_WIDTH;
int h = CARD_HEIGHT;
Card *card;
//Sprite card;
};
class Pile: public Card
{
public:
// ...
bool load_data ( std::string filename );
add(Card *card);
create(); // initialize stack
shuffle(); // randomize pile
getNext();
list();
std::vector<Card> stack;
private:
// ...
};
class Deck: public Pile
{
public:
// virtual Add (Card *card );
// virtual create();
// virtual shuffle();
// virtual getNext();
// virtual list();
};
@i8degrees
Copy link
Author

* https://gist.github.com/i8degrees/5318675
    > SEXY TIME

* http://web.engr.oregonstate.edu/~budd/Books/oopintro3e/info/chap09.pdf 
    > (do note that the above class design is in C#) 

    > okay, so I did end up cheating on my test, but hey! turns out, this is
    indeed what I had already previously came up with independently during my
    first scratchpad "let's play with inheritance" session; I merely lacked
    the confidence to feel certain / ready to bet on my gut :>O

    > no idea how the hell I stumbled across this, other than it was by 
    accident, but it was a pure miracle that I did when I did!

    > okay, so if I'm confessing to one cheat, I might as well go full measure:
    upon reading the paper, I did discover that there was an "identical" c++
    design of what saw in the C# design, written by the same guy, merely ~15
    yrs apart in time. i have yet to cheat past the header files, and do not
    "need" to as of this time, even. simple stuff it is past the declarations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment