Home > C#, Game > Card Memory Game

Card Memory Game

November 17th, 2008 Leave a comment Go to comments

Introduction

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”:

cardmemorygame

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.

Download

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!

Note
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 **************
    mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    —————————————-
    CardMemoryGame
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Unknown/Desktop/CardMemoryGame.exe
    —————————————-
    System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    —————————————-
    System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    —————————————-
    System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    —————————————-

    ************** 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
    enabled.

    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.