954,499 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Pointer to instance

I am trying to make a card class that has a bunch of functions to make it possible for the AI to judge what cards can be played. The card game I am working on at the moment is Rummy by order of my brother. I made a 3 pointer instances of my card class. I think that I will use these to point at other instances and judge whether a card can be played or not. The problem is is that I am a fail at pointers so this whole section is completely useless unless I can figure out how to do this. So far, I have figured out how to declare them.

Card *test1;//I think that these will be able to point at other instances.
Card *test2;
Card *test3;//there are only 3 cards at most needed in each time you play down a card in Rummy


Thanks,
JT

jackmaverick1
Posting Whiz in Training
212 posts since May 2010
Reputation Points: 6
Solved Threads: 7
 

Why not make some arrays of Card objects? You could have 3 arrays (or lists or vectors, etc.), one for the deck, one for the hand of the player, and one for the active meld. I know you've done some work on this already, so those are just suggestions.

jonsca
Quantitative Phrenologist
Team Colleague
5,621 posts since Sep 2009
Reputation Points: 1,165
Solved Threads: 581
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: