Computer Science Canada Card Games |
Author: | TheFerret [ Wed Mar 31, 2004 12:58 pm ] | ||
Post subject: | Card Games | ||
I am making an Euchre game and I am trying to make sure that all cards that are delt are different and I found a way but it is very un-effiecnt and she told me to use parrallel arrays and to have first one generate the num and second one to make sure it is different by using boolean but I am not sure how to do it and I can't get it to work...
|
Author: | Dan [ Wed Mar 31, 2004 1:36 pm ] | ||
Post subject: | |||
this is what i whould do:
now there are ways to make this more efishent but it runs prity fast as it is. basily you keep track of what cards have been dealt out and if they are randomly picked agaen it gets a new one rather then uses that all ready used one. also i made it put them in a 2d arrray witch diveds them in to hands so they can be easly useded latter in the progame. also euchre has 25 crads not 24....so i put the right num in my progame. Note: there are 5 hands and i know there are only 4 players but the 5th hand is put down as the kiddy. P.S. if u realy whont to make it more effcent u could make it keep track of the max and min card left to generat so the loop will run fewer times but that whould take up more memory so it is a trade off realy. |