Hello, its my first post here so please mercy for me :P
i have got a project: to write a implementation of card game blackjack in C. But in this game u dont play agnist dealer but between players which count u choose at begining of game. i knew how correct algorism should work, the main problem for me is making a function which deal the cards beetwen players (i meen randomise object from table but in the 2nd drow 1st object is not avalieble) criteria is not to useing "break" "goto" etc. Thx in advance.
Greetings S.
Ps. sorry for my english i hope my post is understandable for everyone :)
implementation of card game Blackjack in C
Started by mith, Nov 14 2009 03:50 AM
3 replies to this topic
#1
Posted 14 November 2009 - 03:50 AM
|
|
|
#2
Posted 14 November 2009 - 03:56 AM
Um, basic C# ? Basic is one language and C# is another, and none of them are in this category, which language are we talking about here?
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall
#3
Posted 14 November 2009 - 04:01 AM
oooups sorry, already edited, i m talking about C
#4
Posted 14 November 2009 - 04:08 AM
great, I'm not so into C, but in general, I'd say you need to define an array of which cards are dealt and not (the deck) , and then randomize to choose which card to give to a player, and by that assign them to a hand.
there are many ways of doing this. one way is to do an array 0..51 where first 13 is hearts, next 13 is spades etc, and assign all positions to 0 as in being in the deck, if a card is dealt, reassign the position to be in the hand's number instead. if a card is disposed, make it -1 instead.
this way, you have only one array to handle, but on the other hand, you need to loop this array extremely many times. If you create an array for each hand instead, it might be easier to keep track of, but you don't have the security that a card can't be double anywhere...
this is just thaughts, an idea....
there are many ways of doing this. one way is to do an array 0..51 where first 13 is hearts, next 13 is spades etc, and assign all positions to 0 as in being in the deck, if a card is dealt, reassign the position to be in the hand's number instead. if a card is disposed, make it -1 instead.
this way, you have only one array to handle, but on the other hand, you need to loop this array extremely many times. If you create an array for each hand instead, it might be easier to keep track of, but you don't have the security that a card can't be double anywhere...
this is just thaughts, an idea....
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall


Sign In
Create Account


Back to top









