Home > C#, Game > Card Memory Game

Card Memory Game

November 17th, 2008 Leave a comment Go to comments


This is a card game that I wrote when I was learning how to program C#. The goal of the game is to clear the table by pairing all the cards. It has three difficulty levels: “Easy”, “Medium”, and “Hard”. Different level contains different numbers of cards on the table. At the “Hard” level, you will deal with 48 cards, which is pretty challenging. Also, the back image of the cards can be selected from “Island”, “Fish”, “Moon Flower”, “Space”, and “Toy Cars”. Below is a screenshot of my “Memory Card Game”:


How to Play

To play a game, choose “File->New Game” and select a level. After the cards are dealt, click on any card and that card will flip to let you see its face. Click on a second card. This second card will flip to show its face too. If the two cards are identical, they will disappear. Otherwise they will flip back so that you won’t be able to see their faces. Keep clicking on the cards until all the cards are paired and disappear.


You are welcome to download the game and try it out. The game can be downloaded here. After downloading the file, unzip it. Then double click “CardMemoryGame.exe” to run. If you find any bugs please let me know. Thanks for looking!

You need Microsoft .NET Framework 2.0 to run this tool. Microsoft .Net Framework can be downloaded from Microsoft website.

Categories: C#, Game Tags: , ,
  1. Katja
    September 21st, 2010 at 12:55 | #1

    Hi there
    Would there be a chance to have a look at the code for the memory game? Thanks. Katja

  2. error log
    August 2nd, 2013 at 13:35 | #2

    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.DllNotFoundException: Unable to load DLL ‘cards.dll’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
    at CardMemoryGame.Card.cdtInit(Int32& width, Int32& height)
    at CardMemoryGame.Card..ctor(Int32 faceOfCard, Int32 suitOfCard)
    at CardMemoryGame.DeckOfCards..ctor()
    at CardMemoryGame.MemoryGame.NewGameDealCards()
    at CardMemoryGame.MemoryGame.newGameToolStripMenuItem_Click(Object sender, EventArgs e)
    at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
    at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
    at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
    at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
    at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
    at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
    at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
    at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
    at System.Windows.Forms.ToolStrip.WndProc(Message& m)
    at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    ************** Loaded Assemblies **************
    Assembly Version:
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    Assembly Version:
    Win32 Version:
    CodeBase: file:///C:/Users/Unknown/Desktop/CardMemoryGame.exe
    Assembly Version:
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/
    Assembly Version:
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/
    Assembly Version:
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/

    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging

    For example:

    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.

  1. No trackbacks yet.