Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
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
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)

shorthair

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
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
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 3 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: