How do i simulate a C++ program that outputs a 52 card random deck and allows a high card cut high card wins?
80762
Here are some code snippets that might be useful.\nNote: I wrote these down, did _not_ compile them, or test them.\n\nThe deck of cards is a array of 52 unsigned integers,\nThey can take a value of 0-52.\n\n//Create an array to hold the deck:\n\nunsigned int Deck[52];\n\nfor(unsigned int i = 0; 1 < 52; i++)\n{\n   Deck[i] = i;\n}\n\n// Shuffle the deck\nsrand(); // Initialize the random number generator\n\nunsigned int temp;\n\n// The shuffle works this way. First round, every card gets a chance\n// to be in slot 51. Second round, each of the remaining cards gets a \n// chance to be in slot 50, third round etc.\n\n\n// Note: This method allows an array value to be swapped with itself, i.e. not moved, which is what you want to get all possible shufflings of the deck.\nfor(unsigned int j = 52; 0< j; j--)\n{\n   // Generate an index in the range 0-j\n   unsigned int k = rand( void ) % (j);\n\n   temp = Deck[k];\n   Deck[k] = Deck[j-1];\n   Deck[j-1] = temp;\n}\n\n///////////////////////////////////\n\nunsigned int GetFaceValueOfCard(unsigned int n)\n{\n  return Deck[n] % 13 + 1;    // Returns a value 1-13\n}\n\n// If you want to get fancy:\n\nchar GetSuitOfCard(unsigned int n)\n{\n   char Suit[4] = "HDCS";\n   return Suit[n/13];\n}
1114741
Here are some great links for C++ games and Graphics Libraries  :\nhttp://www.thefreecountry.com/sourcecode/graphics.shtml\nhttp://www.libsdl.org/index.php\nhttp://www.panelmonkey.org/category.php?id=1\nhttp://www.cppgames.com/
75512
hey champ(Anirudh) !! what happened... so many errors in ur code?\ni hv'nt done much.. just removed the errors.. \nwell ur code was just like an error removing question... that v used to solve in the boards!  i loved solving those easy pickings!!\n\nanyways.. heres the exact code.. \n\n\n#include<iostream.h>\n#include<conio.h>  //for clrscr() & getch()\n\nvoid main()\n{\nclrscr();         //optional\nint array[10],i,least,greatest;\n\n//Input Numbers\ncout<<" Input 10 numbers separated by spaces  : &#92;n";\nfor(i=0;i<10;++i)\n   {\ncin>>array[i];\n   }\n\ngreatest=least=array[0];\n\nfor(i=1;i<10;++i)\n   {\nif(array[i]>greatest)\n     greatest=array[i];\nif(array[i]<least)\n   least=array[i];\n   }\ncout<<"&#92;nLeast in the list is "<<least;\ncout<<"&#92;nGreatest in the list is "<<greatest;\ngetch();//optional\n}
279742
if you have a computer and can get to a keno game you can play any numbers for 50 to 100 spins and on seperate sheet of paper write the numbers from 1 to 80 and each spin put a mark next to the numbers that come up when you have done this go thru and add up to see which numbers come up the most. give that a try it has worked for me. i have done this and went to indian bingo and won at the least $13,000.
1077694
I suggest you visit a site like www.sourceforge.org or www.programmersheaven.com. There are many open-source, game projects written in C.
267921
You can turn these into proper C++ statements:\n\nread a, b\n\nlet max = a\n\nif max < b\n  let max = b\nendif\n\nprint max\n\nThis program assumes that a <> b.
67914
hey!! looking for ur c++ project.. source code online?? isnt a good idea!\n\nwell thetopic u've selected is idiotic.. \nu better submit an original work.. or else u'll loose marks!\n\nn if programming is ur problem.. n u're lookin for an easy way out.. try looking for tutorial sites for c++.. n search for samples .. but then be assured that ur teacher will come to know aboiut the authenticity just by the format.. \n\nwell if u're smart enough to edit the stuff n then submit it.. only then its of some use.\n\nn by the way.. i've heard of this project .. its common.. i mean even some of my batchmates did this project.. a very ordinary 1... so u may get some help from ur seniors as welll!!
411693
A fun program to work with \nhttp://www.gamemaker.nl/
1137758
1) Let's first consider not the combination but the permutations without repetition (considering the order).\n\nSuppose to have 39 numbered cards in your hands and shuffle them well. \nIf you get one card and you drop it on the table you have 39 different possibilities, obviously.\n\nNow, from the remaining 38 cards in your hands, If you drop another card on the right side of the previous card, you'll have 38 different possibilities for just that second choose, but If you consider the order of both cards you'll have exactly 39*38 = 1482 different possibilities that the 2 card will be ordered and choosen in that way.\n\nIf you get a 3rd card from the remaining 37 in your hand you'll have on the table in the right side of previous exraction, a group of 3 ordered cards choosen by 39*38*37 = 54834 different ways will be on the table.\n\nRecursively go to choose until 6 ordered cards will be the table and you'll have 39*38*37*36*35*36 = 2349088560 possibile ways if you consider the order. \n\n2) Now let's see what happend when the order of the selection matters as you asked in your question. \nSo let's make this consideration:\n\na) If you have one card (A) you don't mind about ordering problems:  {A} = (A)\n\nb) if you have two cards (A, B) you have to consider the couple (A, B) = (B, A) so we write {A, B} are commutative;\n\nc) if you have three cards "A", "B" and "C" you can group (A, B) as one element {A, B} because order doesn't matter (point b).\n\nSo we can consider the 3 cards (A, B, C) as:\n ( {A, B}, C ) = ( C, {A, B} ) as we made in the point b.\nYou could also group (A, {B, C}) = ( {B, C}, A)  or {A, C} and then swapping with B.\n\nSo with 3 elements we have 3 different ways to create couple to swap so we can create 3*2 = 6 different combination.\n\nIf we have 4 cards we know it's possible to choose 4 different ways to create list of 3 cards. Let's stop one each time with your finger and you can see that you can group easily the remaining other 3's.\nSo the possible combination with 4 cards is 4 times the possible combination I have with 3 cards. So it's  4 * (3 * 2).\n\nWith 5 cards you'll have 5 times the number of combinations we found with 4 cards, so it's  5 * (4 * 3 * 2).\n\nFinally, with 6 cards in a table arrange in 6 * 5 * 4 * 3 * 2 = 720 different ordered ways.\n\nNow, your question was how to do if the order of selection matters and in the previous example we find that the number of possibilities we have when we select 6 cards ordered is this number 39*38*37*36*35*34 = 2349088560. And we know now that this number is 720 times greater than the possibilities wether the order of selection doesn't matter. (720 = 6 * 5 * 4 * 3 * 2).\n\nIn other words, 39 * 38 * 37 * 36 * 35 * 34 is the number of permutations without repetition of 39 elements grouped by a list of 6 elements considering the order.\n\nAnd now we know with 6 elements you can have 6*5*4*3*2 possible different positions of those elements. \n\nSo Just divide 39*38*37*36*35*34  by 6*5*4*3*2 and you'll have the result of the combinations.\n\nSo to see how many combination of 6 cards bye a set of 39 just divide 39*38*37*36*35*34 / 6*5*4*3*2 = 3262623.\n\nthe number 6*5*4*3*2 could be wrote "6!" using the the factorial function.\n\nThe factorial function of positive integer n, is defined as the product of first n numbers:\n\nn! = 1 * 2 * 3 * ... * n\n\nand is a convention that the product of no numbers at all is 1.\n\n0! = 1\n\n\nThe factorial is also defined recursively by the follow definition:\n\n(n+1)! = (n+1) * n!\n\n\nSo if you have n object and you want to know how many permutation (the order matters) without repetition (each object can be chosen only once) the objects makes with a number k of selection the formula is:\n \n  n! / (n-k)!\n\nso it's the product of k terms starting from n and descending until reached (n-k+1).\n\nn*(n-1)*(n-2)*.
159881
Use cardboard, clay, or sugar cubs.  Cardoard would be the easiest.
526698
Have you tried adding some kind of animation to it? My idea was doing something along the lines of those big Keno game screens you see at the super market at the lotto desk. The one that shows the current game and has something like bouncing balls land on the number called, or a hockey puck slide in and hit the number called. \n\nThen of course when there is a bingo, make the row spin, change color, throw a party or whatever. The idea is to make the game much like a casino. That will snag you some people willing to play.
1058117
Think of the probability of picking 4 cards from somewhere in the deck and finding them all the same... it would be something like (52/52 x 3/51 x 2/50 x 1/49).  But whatever it is, it doesn't matter.  Just call this probability p.  Now does it matter where you draw the cards from?  If I were to pick the first 4 cards, the last 4 cards, a random collection of cards, alternating cards, etc. will the results be any different?  No, the probability is always the same probability p.\n\nIt's the same with the lottery.  While the sequence 1,2,3,4,5 might seem less likely to occur than something like 13, 17, 26, 37, 42, they actually have the same probability.\n\nHowever, you may notice that dealers always deal one card to each player, then repeat.  They don't deal 5 cards to one, then 5 cards to another, etc.  The reason has nothing to do with probability and everything to do with preventing cheating. It's much easier to perhaps keep a set of cards together while shuffling (with false shuffles, palming, etc.) and then make sure they get placed at the top of the deck.  Then if you dealt them to one person, they'd get all the desirable cards.  However, if you have to alternate, then it is near impossible to arrange the cards so that one person gets the desirable cards.
818217
Heres a program link. Its free too.
294632
oh let me see if i can remember. First you shuffle all the cards. Then you put cards into a pile. 2 players= 30 cards\n3-4 players= 25 cards, 5-6 players= 20 cards. The pile is then placed on the left side of the person. The cards are face down and one card is faced up right on the top of the pile. Then once everyone had a pile then deal out 5 cards to each player. The youngest starts first. All the extra cards go into a draw pile. You have 4 piles in the center of the table and each person has 4 discard piles. To start the piles in the center you either have to have a 1 or a Skip-bo card. Skip-bo card are wild card and can be used for any number. The cards in the center go up numericlly Ex. 1,2,skip-bo, 4 .... 12. Once a pile hits 12 then it is removes and shuffled in to the draw pile. A person turns ends when they can't play any more cards in there had and they discard to there discard piles. If a person runs out of cards before their turn is over then they are allowed to pick up 5 new cards. The point of the game is to remove all the cards from you pile that you were given at the beginning. The first person to play all of ther cards in the pile wins then game. Oh i forgot about the discard pile. You can play your cards in the discard pile. and once ypu play a card in the discard pile it cannot be moved to make room for other cards. Just play on top of the other cards that are there. And you can only play the top card on the discard pile.\n\nI hope that this isn't to confusing!!
438374
I used to work on something like this. If the hardware has GPIB support, i suggest you to use borland C++ builder. It has cool interface and easy to work.
792889
Try a CCG tournament.  Charge a registration fee, like $5.00, and see what you get.  Don't limit it to just one type of game - let 'em go wild.  \n\nHave fun!
607156
There are already many Java Blackjack games available. It's relatively easy to write one, but harder depending on the graphics capabilities you require. I suggest contacting the author of an existing version and see if you can get their source code or obtain a license to use it as you need.