I finally have had the time to update my article. The previous project had some memory leaks in it. Now, the game is more robust. (The application is memory leak free and the architecture of the game is more stable and to my liking.) The project name is FiveInOne (five card games included in one application package). Now, two games are implemented and can be played on a single computer or a networked environment. If conditions favor, I will make the other games available too. The application is designed in such a way that more games can be easily added.
There is a Help System (generated through HTML Help Workshop) integrated in the application. For more information regarding “Marriage” and “Callbreak,” please refer to the help in the application.
Following is a screen shot of the “Marriage” card game.
There are a total of around 65 classes (including structs) and all these classes comprise of a sizeable amount of code. But, the program is all about the interaction betweem two hierarchies of classes. One class hierarchy incorporates multiple inheritance and the other class hierarchy has CView as its base class.
This is an MFC SDI application. I do not intend the users to be able to switch games during play. The player or the user selects the appropriate game at the start of the application. After much speculation, I finally decided that I need not have Document support for my application. The main data of my application are the individual cards that are derived from CBitmapButton and stored, sorted, and manipulated using differents kinds of MFC collection classes (lists and arrays).
I have provided here the source code of the application. I have tested the application on Windows 98 and XP and it works well in them. However, I have not tested it on Windows 2000/ME. I would be glad to know if the application works equally well in Windows 2000/ME.
I am concerned about the animation aspect of the game. If you experience any problems with animation performance, please let me know. I have provided my e-mail address below.
About the “Marriage” Game
It has been popular in my home city for quite a long time. We all enjoy this game during festivals and holidays. The game I have developed is a simple version of the marriage card game. I don’t know where this game originated. But, one thing I know is that it is quite refreshing to play a hand or two of marriage.
This game is comprised of two to four players. Although six players is a possible combination, I have set the maximum number of players to four due to space limitation. The deck consists of three packs of cards. There are certain terms that I would like to clarify before you start playing this game:
Tunnela: If you have three of the same card, you have a tunnela: 2 of hearts, 2 of hearts, and 2 of hearts. Note: 2 of hearts, 2 of hearts, and 2 of spades is not a tunnela.
Pure Sequence: If you have three cards of same suite and in a series, you have is a pure sequence: 7 of diamonds, 8 of diamonds, and 9 of diamonds. 1 (Ace) of clubs, 12 (Queen) of clubs, and 13 (King) of clubs is also a pure sequence. Note: 3 of spades, 4 of spades, and 5 of hearts is not a pure sequence.
Jokers: Any card can be a joker. The joker is decided at the beginning of play. Other cards that are jokers are:
- Tiplu: Same card as that of the joker.
- Poplu: The card just above the Tiplu. If the 7 of diamonds is the Tiplu, the 8 of diamonds is called the Poplu. If the Tiplu is the 1 (Ace) of clubs, the Poplu is the 2 of clubs. If the Tiplu is the 13 (King) of spades, the Poplu is the 1 (Ace) of spades.
- Jhiplu: The card just below the Tiplu. If the 7 of diamonds is the Tiplu, the 6 of diamonds is called the Jhiplu. If the Tiplu is the 1 (Ace) of clubs, the Jhiplu is the 13 (King) of clubs. If the Tiplu is the 13 (King) of spades, the Jhiplu is the 12 (Queen) of spades.
- Ordinary Jokers: If the 11 (Jack) of hearts is the joker, all the 11s (Jacks) are ordinary jokers. The 10 of hearts is the Jhiplu, the 12 (Queen) of hearts is the Poplu, and the 11 (Jack) of hearts is the Tiplu.
Marriage: If you have a Jhiplu, a Tiplu, and a Poplu, you have a marriage. If the Jhiplu, Tiplu, and Poplu are taken as a marriage, they would not carry individual points but the marriage (that is, the set of Jhiplu, Tiplu, and Poplu) will carry the points. Two Jhiplus, two Tiplus, and two Poplus will form a double marriage. Likewise, there is also a minimal chance of a triple marriage: three Jhiplus, three Tiplus, and three Poplus.
First of all, the computer deals cards to all of the players. The joker is not set by individual players as in the usual game, but the joker is set by the computer via simply taking a random number between 1 and 52. Each player has 21 cards that he can play with. The joker can only be seen by those players who have at least three pure sequences. Note: Here, “pure sequence” means either the tunnela or the real pure sequence. The three sets of pure sequences can be two tunnelas and one pure sequence, or three tunnelas all by themselves, or one tunnela and two pure sequences, or all three pure sequences. Whatever the combination, the total number should be three. During the play, each player’s goal should be to make the maximum number of sets (three cards in a set) until all cards are finished. The set can be a pure sequence, a tunnela, a dirty sequence (two cards having the same suite and in a series and one joker), triplet, or a dirty triplet. A triplet, dirty sequence, and dirty triplet can only be made after seeing the joker. Whoever make sets of cards first wins the game.
Note: A dirty sequence can be two cards having the same suit, in a series, and one joker. One card and two jokers can also be a dirty sequence.
Note: A dirty triplet can be two cards having the same number and one joker. One card and two jokers can also be a dirty triplet. There is no difference between a dirty triplet and a dirty sequence with two jokers each.
Note: A triplet is a combination of three cards of the same number but with different suits. The 7 of diamonds, 7 of clubs, and 7 of spades is a triplet. But, the 7 of diamonds, 7 of diamonds, and 7 of spades cannot be a triplet.
Note: A dirty triplet can be a joker plus two other cards having the same number but of different suits; for example, the joker, 7 of diamonds, and 7 of clubs. But, the joker, 7 of diamonds, and 7 of diamonds cannot be a dirty triplet.
The game has two modes: one that you can play on a single computer and one that you can play on a network. In the former mode, you will be the human player and the other players will be the computer. In the latter mode, all the players are human.
The points are calculated at the end of the game. There are two ways to win. The first way is that the player who has finished all the cards in his hand wins the game. But, even if he wins the game, he may be losing if total points are calculated. The second way is that the player who has the maximum total points wins the game. Who wins is left to your discretion.
Note: A right button click produces a pop-up menu. This pop-up menu has all the functionality needed to play the game. Just click the right button menu item to produce the desired effect. For example, to draw or pick a card, click the right button and click the corresponding menu item.
How the Points Are Calculated
All the jokers except the ordinary jokers carry points. The following are the possible combinations and the points carried by each combination.
|Combination||Number of Points|
If a player has the above combination, he is entitled to those points and others who do not have these cards have to pay these points to the ones who have these cards.
The player who makes the play or, in other words, is the winner according to the first win criteria, carries no points. This is the player who collects all the points.
If a player has not made the game, and neither has he seen the joker, his points are reduced by 10.
If a player has not made the game but has seen the joker, his points are reduced by 3.
Note: This marriage game is different than the usual marriage game that we play. Some of these differences are caused by my inability to become a superb programmer. Other differences may be caused by limitation of space and resources. But, in the future versions of marriage, I will try to eliminate these differences the best that I can.
Note: In the household marriage game, there are only two Tiplus in the game because one Tiplu is set as the main joker that every player can see after he finishes three pure sequences. But in this computer version, the main joker is simply a random number between 1 and 52; therefore, there are three possible Tiplus.
Any suggestions, comments, and feedback are welcome