help me with this black jack game
Author |
Message |
help_wanted
|
Posted: Thu Jan 15, 2004 8:10 pm Post subject: help me with this black jack game |
|
|
k it won;t work please tell me why? and how to fix it?
var win := Window.Open ("graphics:640;480")
var card: int
var input: string
var plays: string
var total: int
var dealer: int
var dcard: int
var sel : int
var n : string
loop
total:= Rand.Int(1,10)
put "Welcome to Black Jack Gaming"
delay (1500) cls
put "What is your name?"
get n
cls
put "GOOD EVENING ", n
put "What would you like to do?"
put "1. PLAY"
put "2. RULES"..
get sel
if sel = 1 then
loop
put "You have ", total:2, ", would you like to Hit or Stay? "..
get input
if input = "H" or input = "h" or input = "Hit" or input = "hit" then
card:= Rand.Int(1,10)
else
exit
end if
total:= card + total
exit when total > 21
end loop
loop
dealer:= Rand.Int(1,11)
if dealer < 16 then
dcard:= Rand.Int(1,11)
dealer:= dealer + dcard
end if
exit when dealer >= 16
end loop
put ""
put "*****************************************************"
put "The dealer has ", dealer, "!"
put "You have ", total, "!"
put "*****************************************************"
if total > 21 and dealer > 21 then
put "You and the dealer busted!"
elsif total > 21 then
put "You busted, dealer wins!"
elsif total = dealer then
put "You and the dealer tied!"
elsif total > dealer then
put "You win!"
elsif dealer > 21 then
put "The dealer busted, you win!"
else
put "The dealer wins!"
end if
put "*****************************************************"
put "Would you like to play again? "..
get plays
if plays = "N" or plays = "n" or plays = "No" or plays = "no" then
exit
else
cls
if sel = 2 then
put "RULES"
end if
end if
end loop
Window.Close (win) |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
shorthair
![](http://www.members.shaw.ca/rfolz/domo-kun.jpg)
|
Posted: Sat Jan 17, 2004 6:48 pm Post subject: (No subject) |
|
|
use trace to find the answer or look at the error your getting and post the error , dont just say it dosent work please tell us where itr crashes or what happens , i like to know what im trying to fix |
|
|
|
|
![](images/spacer.gif) |
Tony_200004
|
Posted: Sat Jan 17, 2004 7:01 pm Post subject: (No subject) |
|
|
code: |
var win := Window.Open ("graphics:640;480")
var card: int
var input: string
var plays: string
var total: int
var dealer: int
var dcard: int
var sel : int
var n : string
var r :string (1)
put "Welcome to Black Jack Gaming"
delay (1500) cls
put "What is your name? " ..
get n
cls
put "GOOD EVENING ", n
loop
total:= Rand.Int(2,21)
put "What would you like to do?"
put "1. PLAY "
put "2. RULES "
put "3. QUIT " ..
get sel
if sel = 3 then
put "Press any key to continue... " ..
getch (r)
delay (200)
quit
elsif sel = 2 then
cls
put "BLAHHHHHHHHHHHH this is the rules"
put "Press any key to continue... " ..
getch (r)
delay (200)
cls
elsif sel = 1 then
loop
put "You have ", total:2, ", would you like to Hit or Stay? "..
get input
if input = "H" or input = "h" or input = "Hit" or input = "hit" then
card:= Rand.Int(1,10)
else
exit
end if
total:= card + total
exit when total > 21
end loop
loop
dealer:= Rand.Int(2,11)
if dealer < 16 then
dcard:= Rand.Int(1,11)
dealer:= dealer + dcard
end if
exit when dealer >= 16
end loop
put ""
put "*****************************************************"
put "The dealer has ", dealer, "!"
put "You have ", total, "!"
put "*****************************************************"
if total > 21 and dealer > 21 then
put "You and the dealer busted!"
put "Press any key to continue... " ..
getch (r)
delay (200)
cls
elsif total > 21 then
put "You busted, dealer wins!"
put "Press any key to continue... " ..
getch (r)
delay (200)
cls
elsif total = dealer then
put "You and the dealer tied!"
put "Press any key to continue... " ..
getch (r)
delay (200)
cls
elsif total > dealer then
put "You win!"
put "Press any key to continue... " ..
getch (r)
delay (200)
cls
elsif dealer > 21 then
put "The dealer busted, you win!"
put "Press any key to continue... " ..
getch (r)
delay (200)
cls
else
put "The dealer wins!"
put "Press any key to continue... " ..
getch (r)
delay (200)
cls
end if
end if
end loop
Window.Close (win)
|
i hope that fixed any of your problems |
|
|
|
|
![](images/spacer.gif) |
|
|