Computer Science Canada

need help with blackjack program

Author:  old_School1616 [ Wed Jun 04, 2003 9:26 am ]
Post subject:  need help with blackjack program

I need graphics for blackjack program ex: the cards of the dealer and player one, I have movar games, win1, win2, card1, card2, card3, card4, card5, card6, total, total1, num1, num2, num3, num4, num5, num6, pot1, bet : int
var answer, answer1 : string
games := 0
win1 := 0
win2 := 0
pot1 := 100
loop
cls
put "How much would you like to bet? "
get bet
games := games + 1
randint (num1, 1, 11)
card1 := num1
randint (num2, 1, 11)
card2 := num2
total := card1 + card2
exit when total>21
put "Player 1's cards ", card1, " and ", card2
loop

put "Do you want another card? (y/n)"

get answer
if answer = "y" then
randint (num3, 1, 11)
card3 := num3
total := total + num3
put ""
put "The card is ", card3
put "Player 1's total is ", total
end if
exit when answer = "n"
exit when total > 21
end loop
put ""


randint (num4, 1, 11)
card4 := num4
randint (num5, 1, 11)

card5 := num5
total1 := card4 + card5
put ""
put "Dealers cards are ", card4, " and ", card5
loop
if total1 < 17 then
randint (num6, 1, 11)
card6 := num6
total1 := total1 + num6
put ""
put "The card is ", card6
put "Dealers total is ", total1
end if
exit when total1 > 16
end loop
put ""
if total < total1 and total1 <= 21 then
put "Dealer has won"
put "You have lost ", bet, " dollars"
pot1 := pot1 - bet
put " The amount is now ", pot1 , " dollars"
win2 := win2 + 1
elsif total1 < total and total <= 21 then
put "Player 1 has won"
put " You have gained ", bet, " dollars"
pot1 := pot1 + bet
put " The amount is now ", pot1 , " dollars"
win1 := win1 + 1

elsif total <= 21 and total1 > 21 then
put "Player 1 has won"
put " You have gained ", bet, " dollars"
pot1 := pot1 + bet
put " The amount is now ", pot1, " dollars"
win1 := win1 + 1
elsif total1 <= 21 and total > 21 then
put " Dealer has won"
put " You have lost ", bet, " dollars"
pot1 := pot1 - bet
put " The amount is now ", pot1, " dollars"
win2 := win2 + 1
elsif total = total1 then
put " Dealer has won"
put " You have lost ", bet, " dollar"
pot1 := pot1 - bet
put " The amount is now ", pot1, " dollars"
end if
put ""
put " Number Of ", games, " games played, Dealer ", win2, " and Player 1 has ", win1
put ""
put "Would you like to play again? (y/n)"
get answer1
exit when answer1 = "n"
end loop
st of the code done just not the graphics

Author:  Tony [ Wed Jun 04, 2003 9:27 am ]
Post subject: 

you can download graphics somewhere or use those from solitare...

then just use Pic.Draw

Author:  JSBN [ Wed Jun 04, 2003 11:52 am ]
Post subject: 

Asok..... sound familiar?
lol, yea, what you could try is have an if statement, or whatever of cards and their pictrues and call'em when u need em.

Author:  Asok [ Wed Jun 04, 2003 11:54 am ]
Post subject: 

JSBN please actually read the code, it's not the same Razz

Author:  old_School1616 [ Wed Jun 04, 2003 6:43 pm ]
Post subject: 

You think someone could give me a website with the code for the graphics for blackjack or give me the code it self, cause this program is really really pissing me off I've pretty much tried everything

Author:  Tony [ Wed Jun 04, 2003 7:56 pm ]
Post subject: 

code:
var cardID1 : int := Pic.FileNew("card1.jpg")
Pic.Draw(cardID1,x,y,picCopy)


is this what you're looking for?

Author:  old_School1616 [ Thu Jun 05, 2003 9:42 am ]
Post subject: 

how would you input string's or varables with drawin picture inside turing.


code:
drawbox (100,340,200,200,7)


how would I place a text/numbers with inside this box?

Author:  Prince [ Thu Jun 05, 2003 10:03 am ]
Post subject: 

y not jus draw the cards out line by line (takes forever but gets the job done).. thats how i did it

Author:  tum_twish [ Thu Jun 05, 2003 10:59 am ]
Post subject: 

there are chr values for the suits
if u wanna make ur own

Author:  old_School1616 [ Thu Jun 05, 2003 2:25 pm ]
Post subject: 

ok I'm newb and I have no clue what you people are talking about I have my box but I need to get a number inside of it, so I'm asking how do you put the number inside of my box?

Author:  PaddyLong [ Thu Jun 05, 2003 3:41 pm ]
Post subject: 

I don't think the chr's exist for the suits in Turing 4

but in 3 you could have done
put chr (3) %hearts
put chr (4) %diamonds
put chr (5) %clubs

and I don't know where the spade is... I am not sure that it exists :/


: