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

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




PostPosted: Fri May 26, 2006 9:04 am   Post subject: Blackjack

I am making a blackjack game and I am having problems having the computer just randomly place two cards on the screen. What it does right now is just draw the cards untill my loop ends. Any suggestions on how I would have the computer place the cards on the screen and also have the computer draw another card when the user clicks "hit". Thanks

code:
setscreen ("graphics:819,619")
var font1 : int
var x, y, button : int := 0
var a : int
var cardOne : int := Pic.FileNew ("2-spades.bmp")
var cardTwo : int := Pic.FileNew ("3-clubs.bmp")
var cardThree : int := Pic.FileNew ("4-hearts.bmp")
var cardFour : int := Pic.FileNew ("5-diamonds.bmp")
var cardFive : int := Pic.FileNew ("6-spades.bmp")
var cardSix : int := Pic.FileNew ("7-clubs.bmp")
var cardSeven : int := Pic.FileNew ("8-hearts.bmp")
var cardEight : int := Pic.FileNew ("9-diamonds.bmp")
var cardNine : int := Pic.FileNew ("10-spades.bmp")
var cardTen : int := Pic.FileNew ("jack-clubs.bmp")
var cardEleven : int := Pic.FileNew ("queen-hearts.bmp")
var cardTwelve : int := Pic.FileNew ("king-diamonds.bmp")
var cardThirteen : int := Pic.FileNew ("ace-spades.bmp")
var table : int := Pic.FileNew ("blackjack_table.bmp")
font1 := Font.New ("serif:25:bold")
assert font1 > 0
Pic.Draw (table, 0, 0, picCopy)
loop
    mousewhere (x, y, button)
    drawfillbox (0, maxy, 100, 575, black)
    Font.Draw ("Hit", 25, maxy - 30, font1, white)
    drawfillbox (110, maxy, 210, 575, black)
    Font.Draw ("Stand", 120, maxy - 30, font1, white)
    randint (a, 1, 13)
    case a of
        label 1 :
            Pic.Draw (cardOne, 200, 10, picCopy)
            delay (100)
        label 2 :
            Pic.Draw (cardTwo, 400, 10, picCopy)
            delay (100)
        label 3 :
            Pic.Draw (cardThree, 200, 10, picCopy)
            delay (100)
        label 4 :
            Pic.Draw (cardFour, 400, 10, picCopy)
            delay (100)
        label 5 :
            Pic.Draw (cardFive, 200, 10, picCopy)
            delay (100)
        label 6 :
            Pic.Draw (cardSix, 400, 10, picCopy)
            delay (100)
        label 7 :
            Pic.Draw (cardSeven, 200, 10, picCopy)
            delay (100)
        label 8 :
            Pic.Draw (cardEight, 400, 10, picCopy)
            delay (100)
        label 9 :
            Pic.Draw (cardNine, 200, 10, picCopy)
            delay (100)
        label 10 :
            Pic.Draw (cardTen, 400, 10, picCopy)
            delay (100)
        label 11 :
            Pic.Draw (cardEleven, 200, 10, picCopy)
            delay (100)
        label 12 :
            Pic.Draw (cardTwelve, 400, 10, picCopy)
            delay (100)
        label 13 :
            Pic.Draw (cardThirteen, 200, 10, picCopy)
    end case
    exit when Time.Elapsed > 2000
    if x > 0 and x < 100 and y < maxy and y > 575 and button = 1 then
        cls
    elsif x > 110 and x < 210 and y < maxy and y > 575 and button = 1 then
        cls
    end if
end loop
[/code]
Sponsor
Sponsor
Sponsor
sponsor
TheOneTrueGod




PostPosted: Fri May 26, 2006 10:35 am   Post subject: (No subject)

There have been dozens of topics on this very subject. Use the search button (Located above). You will find oodles of help.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: