blackjack help needed
Author |
Message |
noobprogrammer123
|
Posted: Tue Jun 01, 2004 9:04 pm Post subject: blackjack help needed |
|
|
This is the beginning of my blackjack game but there is a problem with the cards. When it generates the first card then asks for your bet, it generates a new first card.
% VARIABLES
var userCard1, userCard2, userCard3, userCard4, userCard5 : int
var compCard1, compCard2, compCard3, compCard4, compCard5 : int
var userCount1, userCount2, userCount3, userCount4, userCount5 : int
var compCount1, compCount2, compCount3, compCount4, compCount5 : int
var userTotal : int
var compTotal : int
var answer : string (1)
var font1 : int
var bet : int
var picID : array 1 .. 52 of int
var token:int
var blackJackFlash:int
% VARIABLE DECLARATIONS
token:=100
% PICTURES
for rep : 1 .. 52
picID (rep) := Pic.FileNew (intstr (rep) + ".bmp")
end for
% FONTS
font1 := Font.New ("comic sans ms:30")
% OPENING SCREEN
colorback (black)
cls
Font.Draw ("FINESY'S FINE BLACKJACK", 40, 200, font1, green)
delay (2000)
cls
color(yellow)
% LOOP BEGIN
loop
% RANDOMIZING
randint (userCard1, 1, 52)
randint (userCard2, 1, 52)
randint (userCard3, 1, 52)
randint (userCard4, 1, 52)
randint (userCard5, 1, 52)
randint (compCard1, 1, 52)
randint (compCard2, 1, 52)
randint (compCard3, 1, 52)
randint (compCard4, 1, 52)
randint (compCard5, 1, 52)
% DEAL CARD 1
if userCard1 = 1 then
Pic.Draw (picID (1), 100, 100, 0)
elsif userCard1 = 2 then
Pic.Draw (picID (2), 100, 100, 0)
userCount1 := 2
elsif userCard1 = 3 then
Pic.Draw (picID (3), 100, 100, 0)
userCount1 := 3
elsif userCard1 = 4 then
Pic.Draw (picID (4), 100, 100, 0)
userCount1 := 4
elsif userCard1 = 5 then
Pic.Draw (picID (5), 100, 100, 0)
userCount1 := 5
elsif userCard1 = 6 then
Pic.Draw (picID (6), 100, 100, 0)
userCount1 := 6
elsif userCard1 = 7 then
Pic.Draw (picID (7), 100, 100, 0)
userCount1 := 7
elsif userCard1 = 8 then
Pic.Draw (picID (8), 100, 100, 0)
userCount1 := 8
elsif userCard1 = 9 then
Pic.Draw (picID (9), 100, 100, 0)
userCount1 := 9
elsif userCard1 = 10 then
Pic.Draw (picID (10), 100, 100, 0)
userCount1 := 10
elsif userCard1 = 11 then
Pic.Draw (picID (11), 100, 100, 0)
userCount1 := 10
elsif userCard1 = 12 then
Pic.Draw (picID (12), 100, 100, 0)
userCount1 := 10
elsif userCard1 = 13 then
Pic.Draw (picID (13), 100, 100, 0)
userCount1 := 10
elsif userCard1 = 14 then
Pic.Draw (picID (14), 100, 100, 0)
elsif userCard1 = 15 then
Pic.Draw (picID (15), 100, 100, 0)
userCount1 := 2
elsif userCard1 = 16 then
Pic.Draw (picID (16), 100, 100, 0)
userCount1 := 3
elsif userCard1 = 17 then
Pic.Draw (picID (17), 100, 100, 0)
userCount1 := 4
elsif userCard1 = 18 then
Pic.Draw (picID (18), 100, 100, 0)
userCount1 := 5
elsif userCard1 = 19 then
Pic.Draw (picID (19), 100, 100, 0)
userCount1 := 6
elsif userCard1 = 20 then
Pic.Draw (picID (20), 100, 100, 0)
userCount1 := 7
elsif userCard1 = 21 then
Pic.Draw (picID (21), 100, 100, 0)
userCount1 := 8
elsif userCard1 = 22 then
Pic.Draw (picID (22), 100, 100, 0)
userCount1 := 9
elsif userCard1 = 23 then
Pic.Draw (picID (23), 100, 100, 0)
userCount1 := 10
elsif userCard1 = 24 then
Pic.Draw (picID (24), 100, 100, 0)
userCount1 := 10
elsif userCard1 = 25 then
Pic.Draw (picID (25), 100, 100, 0)
userCount1 := 10
elsif userCard1 = 26 then
Pic.Draw (picID (26), 100, 100, 0)
userCount1 := 10
elsif userCard1 = 27 then
Pic.Draw (picID (27), 100, 100, 0)
elsif userCard1 = 28 then
Pic.Draw (picID (28), 100, 100, 0)
userCount1 := 2
elsif userCard1 = 29 then
Pic.Draw (picID (29), 100, 100, 0)
userCount1 := 3
elsif userCard1 = 30 then
Pic.Draw (picID (30), 100, 100, 0)
userCount1 := 4
elsif userCard1 = 31 then
Pic.Draw (picID (31), 100, 100, 0)
userCount1 := 5
elsif userCard1 = 32 then
Pic.Draw (picID (32), 100, 100, 0)
userCount1 := 6
elsif userCard1 = 33 then
Pic.Draw (picID (33), 100, 100, 0)
userCount1 := 7
elsif userCard1 = 34 then
Pic.Draw (picID (34), 100, 100, 0)
userCount1 := 8
elsif userCard1 = 35 then
Pic.Draw (picID (35), 100, 100, 0)
userCount1 := 9
elsif userCard1 = 36 then
Pic.Draw (picID (36), 100, 100, 0)
userCount1 := 10
elsif userCard1 = 37 then
Pic.Draw (picID (37), 100, 100, 0)
userCount1 := 10
elsif userCard1 = 38 then
Pic.Draw (picID (38), 100, 100, 0)
userCount1 := 10
elsif userCard1 = 39 then
Pic.Draw (picID (39), 100, 100, 0)
userCount1 := 10
elsif userCard1 = 40 then
Pic.Draw (picID (40), 100, 100, 0)
elsif userCard1 = 41 then
Pic.Draw (picID (41), 100, 100, 0)
userCount1 := 2
elsif userCard1 = 42 then
Pic.Draw (picID (42), 100, 100, 0)
userCount1 := 3
elsif userCard1 = 43 then
Pic.Draw (picID (43), 100, 100, 0)
userCount1 := 4
elsif userCard1 = 44 then
Pic.Draw (picID (44), 100, 100, 0)
userCount1 := 5
elsif userCard1 = 45 then
Pic.Draw (picID (45), 100, 100, 0)
userCount1 := 6
elsif userCard1 = 46 then
Pic.Draw (picID (46), 100, 100, 0)
userCount1 := 7
elsif userCard1 = 47 then
Pic.Draw (picID (47), 100, 100, 0)
userCount1 := 8
elsif userCard1 = 48 then
Pic.Draw (picID (48), 100, 100, 0)
userCount1 := 9
elsif userCard1 = 49 then
Pic.Draw (picID (49), 100, 100, 0)
userCount1 := 10
elsif userCard1 = 50 then
Pic.Draw (picID (50), 100, 100, 0)
userCount1 := 10
elsif userCard1 = 51 then
Pic.Draw (picID (51), 100, 100, 0)
userCount1 := 10
elsif userCard1 = 52 then
Pic.Draw (picID (52), 100, 100, 0)
userCount1 := 10
end if
% BLACKJACK?
if userCard1=37 or userCard1=50 then
for a:1..20
randint(blackJackFlash,1,255)
Font.Draw("BLACKJACK",100,300,font1,blackJackFlash)
delay(100)
colorback(black)
cls
end for
token:=token*2
% USER BET
else
locate (1, 1)
delay(1000)
put "How much would you like to bet?"
get bet
token:=token-bet
delay(100)
% DEAL CARD 2
if userCard2 = 1 then
Pic.Draw (picID (1), 205, 100, 0)
elsif userCard2 = 2 then
Pic.Draw (picID (2), 205, 100, 0)
userCount2 := 2
elsif userCard2 = 3 then
Pic.Draw (picID (3), 205, 100, 0)
userCount2 := 3
elsif userCard2 = 4 then
Pic.Draw (picID (4), 205, 100, 0)
userCount2 := 4
elsif userCard2 = 5 then
Pic.Draw (picID (5), 205, 100, 0)
userCount2 := 5
elsif userCard2 = 6 then
Pic.Draw (picID (6), 205, 100, 0)
userCount2 := 6
elsif userCard2 = 7 then
Pic.Draw (picID (7), 205, 100, 0)
userCount2 := 7
elsif userCard2 = 8 then
Pic.Draw (picID (8), 205, 100, 0)
userCount2 := 8
elsif userCard2 = 9 then
Pic.Draw (picID (9), 205, 100, 0)
userCount2 := 9
elsif userCard2 = 10 then
Pic.Draw (picID (10), 205, 100, 0)
userCount2 := 10
elsif userCard2 = 11 then
Pic.Draw (picID (11), 205, 100, 0)
userCount2 := 10
elsif userCard2 = 12 then
Pic.Draw (picID (12), 205, 100, 0)
userCount2 := 10
elsif userCard2 = 13 then
Pic.Draw (picID (13), 205, 100, 0)
userCount2 := 10
elsif userCard2 = 14 then
Pic.Draw (picID (14), 205, 100, 0)
elsif userCard2 = 15 then
Pic.Draw (picID (15), 205, 100, 0)
userCount2 := 2
elsif userCard2 = 16 then
Pic.Draw (picID (16), 205, 100, 0)
userCount2 := 3
elsif userCard2 = 17 then
Pic.Draw (picID (17), 205, 100, 0)
userCount2 := 4
elsif userCard2 = 18 then
Pic.Draw (picID (18), 205, 100, 0)
userCount2 := 5
elsif userCard2 = 19 then
Pic.Draw (picID (19), 205, 100, 0)
userCount2 := 6
elsif userCard2 = 20 then
Pic.Draw (picID (20), 205, 100, 0)
userCount2 := 7
elsif userCard2 = 21 then
Pic.Draw (picID (21), 205, 100, 0)
userCount2 := 8
elsif userCard2 = 22 then
Pic.Draw (picID (22), 205, 100, 0)
userCount2 := 9
elsif userCard2 = 23 then
Pic.Draw (picID (23), 205, 100, 0)
userCount2 := 10
elsif userCard2 = 24 then
Pic.Draw (picID (24), 205, 100, 0)
userCount2 := 10
elsif userCard2 = 25 then
Pic.Draw (picID (25), 205, 100, 0)
userCount2 := 10
elsif userCard2 = 26 then
Pic.Draw (picID (26), 205, 100, 0)
userCount2 := 10
elsif userCard2 = 27 then
Pic.Draw (picID (27), 205, 100, 0)
elsif userCard2 = 28 then
Pic.Draw (picID (28), 205, 100, 0)
userCount2 := 2
elsif userCard2 = 29 then
Pic.Draw (picID (29), 205, 100, 0)
userCount2 := 3
elsif userCard2 = 30 then
Pic.Draw (picID (30), 205, 100, 0)
userCount2 := 4
elsif userCard2 = 31 then
Pic.Draw (picID (31), 205, 100, 0)
userCount2 := 5
elsif userCard2 = 32 then
Pic.Draw (picID (32), 205, 100, 0)
userCount2 := 6
elsif userCard2 = 33 then
Pic.Draw (picID (33), 205, 100, 0)
userCount2 := 7
elsif userCard2 = 34 then
Pic.Draw (picID (34), 205, 100, 0)
userCount2 := 8
elsif userCard2 = 35 then
Pic.Draw (picID (35), 205, 100, 0)
userCount2 := 9
elsif userCard2 = 36 then
Pic.Draw (picID (36), 205, 100, 0)
userCount2 := 10
elsif userCard2 = 37 then
Pic.Draw (picID (37), 205, 100, 0)
userCount2 := 10
elsif userCard2 = 38 then
Pic.Draw (picID (38), 205, 100, 0)
userCount2 := 10
elsif userCard2 = 39 then
Pic.Draw (picID (39), 205, 100, 0)
userCount2 := 10
elsif userCard2 = 40 then
Pic.Draw (picID (40), 205, 100, 0)
elsif userCard2 = 41 then
Pic.Draw (picID (41), 205, 100, 0)
userCount2 := 2
elsif userCard2 = 42 then
Pic.Draw (picID (42), 205, 100, 0)
userCount2 := 3
elsif userCard2 = 43 then
Pic.Draw (picID (43), 205, 100, 0)
userCount2 := 4
elsif userCard2 = 44 then
Pic.Draw (picID (44), 205, 100, 0)
userCount2 := 5
elsif userCard2 = 45 then
Pic.Draw (picID (45), 205, 100, 0)
userCount2 := 6
elsif userCard2 = 46 then
Pic.Draw (picID (46), 205, 100, 0)
userCount2 := 7
elsif userCard2 = 47 then
Pic.Draw (picID (47), 205, 100, 0)
userCount2 := 8
elsif userCard2 = 48 then
Pic.Draw (picID (48), 205, 100, 0)
userCount2 := 9
elsif userCard2 = 49 then
Pic.Draw (picID (49), 205, 100, 0)
userCount2 := 10
elsif userCard2 = 50 then
Pic.Draw (picID (50), 205, 100, 0)
userCount2 := 10
elsif userCard2 = 51 then
Pic.Draw (picID (51), 205, 100, 0)
userCount2 := 10
elsif userCard2 = 52 then
Pic.Draw (picID (52), 205, 100, 0)
userCount2 := 10
end if
% USER CHOICE
% LOOP END
end if
end loop |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
|
|
|
|
noobprogrammer123
|
Posted: Tue Jun 01, 2004 9:13 pm Post subject: (No subject) |
|
|
that will work, any ideas on why it changes? |
|
|
|
|
|
noobprogrammer123
|
Posted: Tue Jun 01, 2004 9:15 pm Post subject: (No subject) |
|
|
Also, how do i make it so none of the cards will end up the same |
|
|
|
|
|
Tony
|
|
|
|
|
|
|