Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Black jack problem
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
rupert_lucy




PostPosted: Sun Nov 16, 2003 12:48 am   Post subject: Black jack problem

Hello. If you guys could help me, I would really really appreciate it..
Seriously, I do not know anything about this..and I'm totally lost during the class and so are others. but the teacher told us to make a Black jack program.. and I just have NO IDEA what to do...
Can somebody help me??
I don't even know what Black jack is!!!!!!!!!!! Crying or Very sad Crying or Very sad
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun Nov 16, 2003 1:00 am   Post subject: (No subject)

wow... well if you dont understand a thing in class... maybe you shouldn't be taking it Thinking

BlackJack is a card game. The objective is to get as close to 21 as possible, without going over it. Each number card is worth the number on it. Each face card is 10. Ace is ether 1 or 11.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
DanShadow




PostPosted: Sun Dec 07, 2003 7:57 pm   Post subject: ..

Yeah...if you can't design something as simple as BlackJack...well, its just kind of sad. My teacher told me to design a text based blackjack, so I did, it was easy. Then I started a new one, made a little graphics, here is th e code for what I did on that. (I stopped coding that a long while ago, im pretty sure you could adapt it for your purposes.) This is not to give you the answer to your problem, but help you understand it, and help you understand how to find a solution. Very Happy
code:

var card, npctotal, npccard, total, num, cash, bet, intin : int
var input : string
cash := 10
procedure reset
    total := 0
    card := 0
    npctotal := 0
    num := 0
    bet := 0
    Draw.Box (10, 10, 80, 120, 255)
    Draw.Box (90, 10, 160, 120, 255)
    Draw.Box (10, 260, 80, 370, 255)
    Draw.Box (90, 260, 160, 370, 255)
    locate (19, 22)
    put "Cards Total: ", total, "" ..
    locate (20, 22)
    put "Cash: $", cash
    locate (21, 22)
    put "Bet: $", bet
    locate (25, 22)
    put "[hit , stand , raise bet , lower bet]"
end reset
reset
loop
    locate (23, 22)
    put " "
    locate (23, 22)
    put "Command: " ..
    get input : *
    if input = "hit" then
        randint (card, 1, 10)
        total := total + card
        num := num + 1
    elsif input = "raise bet" then
        locate (18, 40)
        put ""
        locate (18, 40)
        put "By how much: " ..
        get intin
        if intin <= cash then
            bet := bet + intin
            cash := cash - intin
            locate (18, 40)
            put ""
            locate (18, 40)
            put "Bet raised up $", intin
        else
            locate (18, 40)
            put ""
            locate (18, 40)
            put "You do not have $", intin, " to bet!"
        end if
    elsif input = "lower bet" then
        locate (18, 40)
        put ""
        locate (18, 40)
        put "By how much: " ..
        get intin
        if intin <= bet then
            bet := bet - intin
            cash := cash + intin
            locate (18, 40)
            put ""
            locate (18, 40)
            put "You take $", intin, " out of your bet."
        else
            locate (18, 40)
            put ""
            locate (18, 40)
            put "You cant lower your bet more than ", bet
        end if
    end if
    locate (19, 3)
    put "Card: ", card, "" ..
    locate (19, 22)
    put "Cards Total: ", total, "" ..
    locate (20, 22)
    put "Cash: $", cash
    locate (21, 22)
    put "Bet: $", bet
    %666666
    locate (17 + num, 13)
    put "          " ..
    locate (17 + num, 13)
    put "Card: ", card, "" ..
    %666666
end loop
Andy




PostPosted: Sun Dec 07, 2003 9:28 pm   Post subject: (No subject)

uhhh way to break our no cheating policy
DanShadow




PostPosted: Sun Dec 07, 2003 9:42 pm   Post subject: (No subject)

huh?! What is he using that to cheat at? Is that question in a contest or something??? Anyway, I just gave him the code to give him a ""general idea"" of how a graphical blackjack might work
koby93




PostPosted: Mon Dec 08, 2003 11:05 pm   Post subject: (No subject)

hey lucy are u from london ontairo and go to CCH high schol?
casue i think i know u
n e ways if u get this repy in private msg aight?
peace and ps do u have programming in 2nd peroid with Mr.Lyle?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: