Creating the "Marriage" Card Game

Hi, Everyone.

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.

Playing Marriage

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
Single Jhiplu 2
Single Tiplu 2
Single Poplu 2
Double Jhiplu 5
Double Tiplu 5
Double Poplu 5
Triple Jhiplu 10
Triple Tiplu 10
Triple Poplu 10
Single Marriage 10
Double Marriage 30
Triple Marriage 50
Simple Tunnela 5
Joker Tunnela 10
Jhiplu Tunnela 20
Tiplu Tunnela 20
Poplu Tunnela 20

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

E-mail: oopsbabies@hotmail.com, miteshrajpandey@yahoo.com, shailaj@mail.com.np



About the Author

Mitesh Pandey

I love object oriented languages. I have know-how in the following fields: Core C++, Visual C++, STL, MFC, COM, ATL, DirectX, Managed C++, C#, PHP, MySQL, OpenGL.

Downloads

Comments

  • ..

    Posted by James rai on 11/16/2014 03:42am

    After donloading you get an ext file calls marriage2. What next?

    Reply
  • thehe

    Posted by asdfa on 03/14/2013 04:00am

    ;aflkjdfa;lksjdfja;sdljfk

    Reply
  • sdaf;ljkdf

    Posted by tjhss on 03/14/2013 03:59am

    sadfadfasdf;laskjdf

    Reply
  • http://www.mulberrybagsoutlet2uk.com/

    Posted by jisko on 03/13/2013 08:59pm

    On the list of their seasonless bag things, Mulberry Bayswater Bag is probably the most typical parts Molly wore hers by helping cover their the Mulberry Pool Gathering a little bit ago teamed with metallic trrymla heels and ideal gold jewellery; whilst Liv worked hers with robust black heels along with a far more nipped in waist Most of these attractions are believed to be [url=http://www.mulberrybagsoutlet2uk.com]www.mulberrybagsoutlet2uk.com[/url] by using an once-a-year basis from throughout Age 14 k global prospective customers and various 26 trillion who surface inside the great britain in assist of continue being at the earliest opportunity Should you acquire a seem at each and every line which is been named off that Prada generates you?ll find that it could be very distinctive and unbelievably thoughtful with regards to [url=http://www.mulberrybagsoutlet2uk.com]Mulberry Bags on Sale[/url] what are the pattern for the Mulberry Footwear seem like and exactly how believe that verses an extra model can be quite a average within the blue-collar participant I confidence that all population ought to carry forward a determination over the genuine Mulberrythree blocks, in time, he should really manage to in Yao fate, [url=http://www.mulberrybagsoutlet2uk.com/dk]Discount Mulberry Tasker[/url] in the staff for the defensive finish to inject much more vitality Nobody would like to choose the Prada manufacturer backing them up.

    Reply
  • How to install in Mac OX Lion

    Posted by santosh on 06/11/2012 12:04pm

    How to install marriage game in Mac OX Lion?

    Reply
  • great application

    Posted by roshik on 04/18/2012 10:37am

    plz provide me the exe file of marriage..

    Reply
  • AI books for marriage and other card games

    Posted by Ajan RedDevil on 08/26/2010 12:54pm

    Could you suggest any AI books for card games???

    Reply
  • The other games

    Posted by nyjohnson on 01/11/2006 09:54am

    Great job. Nice to learn more about how to make a card game. Can you please send me a link where the other games are? Thank you! (E-mail: nyjohnson@yahoo.com)

    • The other games

      Posted by miteshpandey on 01/13/2006 08:47am

      Thank you very much nyjohnson. Only two games are implemented as of latest. I am currently working on the other three of the games. As soon as it is finished I will update the source code here at CG.

      Reply
    • First, learn how to write

      Posted by nyjohnson on 01/13/2006 05:53am

      Hello getjohsun, what do you mean with "I hvae a game"? First, learn how to write before starting a discussion.

      Reply
    • nyjohnson

      Posted by getjohsun on 01/12/2006 07:28pm

      Hello, nyjohnson, I hvae a game called "Monkey in the bush" an old game, but I still have the cd if you still like to get
      
      Contact me onmyjohnson@cheerful.com

      Reply
    Reply
  • Source files

    Posted by Roger64 on 02/16/2005 10:37am

    There are several source files missing: Client.cpp msg.cpp FiveInOneView.cpp and others.

    • Source files

      Posted by miteshpandey on 03/03/2005 06:12pm

      Don't use the poject file. Use the solution file. This project was started as a visual studio 6.0 project but it evolved as a visual studio .net (7.0) project.

      Reply
    Reply
  • discard

    Posted by elkirf on 04/18/2004 11:50pm

    can anyone give me a website where i can generate a crdit card with billing address.

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • CentreCorp is a fully integrated and diversified property management and real estate service company, specializing in the "shopping center" segment, and is one of the premier retail service providers in North America. Company executives travel a great deal, carrying a number of traveling laptops with critical current business data, and no easy way to back up to the network outside the office. Read this case study to learn how CentreCorp implemented a suite of business continuity services that included …

Most Popular Programming Stories

More for Developers

RSS Feeds