Jump to content

implementation of card game Blackjack in C

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
mith

mith

    Newbie

  • Members
  • PipPip
  • 18 posts
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 :)

#2
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,298 posts
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

#3
mith

mith

    Newbie

  • Members
  • PipPip
  • 18 posts
oooups sorry, already edited, i m talking about C

#4
Orjan

Orjan

    Writes binary right handed and hex left handed

  • Moderators
  • 3,298 posts
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....
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall