Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

My task is to create a matchign game with 20 cards (like memory). There is no limitations on how we designs this except that i need you to keep in mind that i haven't done programming before and so i don't knwo anything like Me or all that. So far i have created the cards as 20 buttons and am trying to make an array from them....assign them numbers and then compare them to see if the cards "match" - whether they are a pair (there will be ten pairs in teh twnety cards). Once they are matched they are taken out of the game - so i guess that means i delete them from the array. However, i'm having troubel tryign to work out how i can compare the buttons - compare what exactly? - can i compare the buttons' text properties if i give them one?? Also i need the cards to be in a different position each time the cardgame is played - so i need to be able to implement a random number generator

 

Please, Please, Please,

If you can help me at all

Please Post asap

 

Thanks

Posted

Your request is not that difficult at all to achieve. Your on the right track, Create An Integer Array Of Say 20. Then Use A Random Number Generator To Put The Numbers In Different Locations. You Can Then Use The Number Locations To Associate Them Selves With Different Cards. Heres An Example, Lets Say The Last Card In Row 1, That Button Would ALWAYS BE Corresponded With Say The Index Of 5 In The Array.

So If You Generate A Number X For That Array, Then Let Your Program Randomly Generate Another Index In The Array Besides The One That Is Already Used And Place X For That Button As Well. If You Don't Understand What I'm saying, Let Me Know And I'll post An Example On Here For You. Good Luck

 

-=Simcoder=-

Whatever thy hand findest to do, do it with all thy heart - Jesus
Posted (edited)
Here, I decided to attach a zip file containing a sample match game. Took about 20 minutes to make. I hope this helps you more with your project.

Card Game Example.zip

Edited by PlausiblyDamp
Whatever thy hand findest to do, do it with all thy heart - Jesus

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...