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

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




PostPosted: Sun May 23, 2004 4:08 pm   Post subject: black jack helpppp

can any one tell me why it would not add the score probably at the end??

var p1 : int := Pic.FileNew ("acehearts.jpg")
var p2 : int := Pic.FileNew ("aceclubs.jpg")
var p3 : int := Pic.FileNew ("acediamonds.jpg")
var p4 : int := Pic.FileNew ("acespades.jpg")
var p5 : int := Pic.FileNew ("twohearts.jpg")
var p6 : int := Pic.FileNew ("twoclubs.jpg")
var p7 : int := Pic.FileNew ("twospades.jpg")
var p8 : int := Pic.FileNew ("twodiamonds.jpg")
var p9 : int := Pic.FileNew ("threehearts.jpg")
var p10 : int := Pic.FileNew ("threeclubs.jpg")
var p11 : int := Pic.FileNew ("threespades.jpg")
var p12 : int := Pic.FileNew ("threediamonds.jpg")
var p13 : int := Pic.FileNew ("fourhearts.jpg")
var p14 : int := Pic.FileNew ("fourclubs.jpg")
var p15 : int := Pic.FileNew ("fourspades.jpg")
var p16 : int := Pic.FileNew ("fourdiamonds.jpg")
var p17 : int := Pic.FileNew ("fivehearts.jpg")
var p18 : int := Pic.FileNew ("fiveclubs.jpg")
var p19 : int := Pic.FileNew ("fivespades.jpg")
var p20 : int := Pic.FileNew ("fivediamonds.jpg")
var p21 : int := Pic.FileNew ("sixhearts.jpg")
var p22 : int := Pic.FileNew ("sixclubs.jpg")
var p23 : int := Pic.FileNew ("sixspades.jpg")
var p24 : int := Pic.FileNew ("sixdiamonds.jpg")
var p25 : int := Pic.FileNew ("sevenhearts.jpg")
var p26 : int := Pic.FileNew ("sevenclubs.jpg")
var p27 : int := Pic.FileNew ("sevendiamonds.jpg")
var p28 : int := Pic.FileNew ("sevenspades.jpg")
var p29 : int := Pic.FileNew ("eighthearts.jpg")
var p30 : int := Pic.FileNew ("eightclubs.jpg")
var p31 : int := Pic.FileNew ("eightspades.jpg")
var p32 : int := Pic.FileNew ("eightdiamonds.jpg")
var p33 : int := Pic.FileNew ("ninehearts.jpg")
var p34 : int := Pic.FileNew ("nineclubs.jpg")
var p35 : int := Pic.FileNew ("ninespades.jpg")
var p36 : int := Pic.FileNew ("ninediamonds.jpg")
var p37 : int := Pic.FileNew ("tenhearts.jpg")
var p38 : int := Pic.FileNew ("tenclubs.jpg")
var p39 : int := Pic.FileNew ("tenspades.jpg")
var p40 : int := Pic.FileNew ("tendiamonds.jpg")
var p41 : int := Pic.FileNew ("jackhearts.jpg")
var p42 : int := Pic.FileNew ("jackclubs.jpg")
var p43 : int := Pic.FileNew ("jackspades.jpg")
var p44 : int := Pic.FileNew ("jackdiamonds.jpg")
var p45 : int := Pic.FileNew ("queenhearts.jpg")
var p46 : int := Pic.FileNew ("queenclubs.jpg")
var p47 : int := Pic.FileNew ("queenspades.jpg")
var p48 : int := Pic.FileNew ("queendiamonds.jpg")
var p49 : int := Pic.FileNew ("kinghearts.jpg")
var p50 : int := Pic.FileNew ("kingclubs.jpg")
var p51 : int := Pic.FileNew ("kingspades.jpg")
var p52 : int := Pic.FileNew ("kingdiamonds.jpg")

randomize
var y:int:=0
randint (y,p1,p52)
var x:int:=0
randint (x,p1,p52)

Pic.Draw (x, 40, 90, picCopy)
Pic.Draw (y, 60, 70, picCopy)
var sum:int:=0
var x5,y5,bnum5,bud5:int
var e:int:=0
loop
buttonwait ("down", x5, y5, bnum5, bud5)

if x5 >= 280 and x5 <= 380 and y5 >= 80 and y5 <= 120 then

var p:int:=0
randint (p,p1,p52)

Pic.Draw (p, 80, 50, picCopy)
p:=e
end if

var m:int:=0
var x6,y6,bnum6,bud6:int
loop
buttonwait ("down", x6, y6, bnum6, bud6)

if x6 >= 280 and x6 <= 380 and y6 >= 80 and y6 <= 120 then

var k:int:=0
randint (k,p1,p52)
Pic.Draw (k, 100, 30, picCopy)
k:=m
end if


var x7,y7,bnum7,bud7:int
loop
buttonwait ("down", x7, y7, bnum7, bud7)

if x7 >= 280 and x7 <= 380 and y7 >= 30 and y7 <= 70 then

p1 :=1
p2 :=1
p3 :=1
p4 :=1
p5 :=2
p6 :=2
p7 :=2
p8 :=2
p9 :=3
p10 :=3
p11 :=3
p12 :=3
p13 :=4
p14 :=4
p15 :=4
p16 :=4
p17 :=5
p18 :=5
p19 :=5
p20 :=5
p21 :=6
p22 :=6
p23 :=6
p24 :=6
p25 :=7
p26 :=7
p27 :=7
p28 :=7
p29 :=8
p30 :=8
p31 :=8
p32 :=8
p33 :=9
p34 :=9
p35 :=9
p36 :=9
p37 :=10
p38 :=10
p39 :=10
p40 :=10
p41 :=10
p42 :=10
p43 :=10
p44 :=10
p45 :=10
p46 :=10
p47 :=10
p48 :=10
p49 :=10
p50 :=10
p51 :=10
p52 :=10

sum:=sum+y
sum:=sum+x
sum:=sum+m
sum:=sum+e
put sum

end if
Sponsor
Sponsor
Sponsor
sponsor
Paul




PostPosted: Sun May 23, 2004 8:08 pm   Post subject: (No subject)

Im not sure what ur asking, but dude...
you need to learn how to use arrays
http://www.compsci.ca/v2/viewtopic.php?t=366
along with for loops.
AsianSensation




PostPosted: Sun May 23, 2004 9:41 pm   Post subject: (No subject)

dude, you completely killed me with that coding style. Try better variable names, because it's easier for you and me to see the problem.

Anyways, found your problem.

when you did this

code:
sum:=sum+y
sum:=sum+x
sum:=sum+m
sum:=sum+e


you added wrong.

Because you assigned x and y values equal to that of a picture ID, which does not have integer values that you wanted. I see that you changed it afterward, but you didn't change the value of x and y. you only changed the integer value for your picture (which btw, is a bad programming style)
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  [ 3 Posts ]
Jump to:   


Style:  
Search: