-
Jul 16th, 2017, 06:37 AM
#1
Thread Starter
Lively Member
My procedure DetermineCardPath
Is there any problem in this procedure:
clsCard is a class I made
crdTwo, crdThree ... etc are values of an Enum I made, it's public and it's in the class module
this procedure is in a standard module
Code:
Public Sub DetermineCardPath(X As clsCard)
Select Case X.Card
Case crdTwo: X.CardPath = App.Path & "\Cards\2_of_hearts.jpg"
Case crdThree: X.CardPath = App.Path & "\Cards\3_of_hearts.jpg"
Case crdFour: X.CardPath = App.Path & "\Cards\4_of_hearts.jpg"
Case crdFive: X.CardPath = App.Path & "\Cards\5_of_hearts.jpg"
Case crdSix: X.CardPath = App.Path & "\Cards\6_of_hearts.jpg"
Case crdSeven: X.CardPath = App.Path & "\Cards\7_of_hearts.jpg"
Case crdEight: X.CardPath = App.Path & "\Cards\8_of_hearts.jpg"
Case crdNine: X.CardPath = App.Path & "\Cards\9_of_hearts.jpg"
Case crdTen: X.CardPath = App.Path & "\Cards\10_of_hearts.jpg"
Case crdJack: X.CardPath = App.Path & "\Cards\jack_of_hearts.jpg"
Case crdQueen: X.CardPath = App.Path & "\Cards\queen_of_hearts.jpg"
Case crdKing: X.CardPath = App.Path & "\Cards\king_of_hearts.jpg"
Case crdAce: X.CardPath = App.Path & "\Cards\ace_of_hearts.jpg"
End Select
End Sub
the Enum inside the class module is:
Code:
Public Enum enmCardName
crdTwo = 2
crdThree
crdFour
crdFive
crdSix
crdSeven
crdEight
crdNine
crdTen
crdJack
crdQueen
crdKing
crdAce
End Enum
-
Jul 16th, 2017, 06:56 AM
#2
Re: My procedure DetermineCardPath
What are you trying to accomplish? Are you also going to expand to all 52 cards (or 54 with the two Jokers)? Would not an array of 'crds' work better possibly (crds(1) through crds(54))?
-
Jul 16th, 2017, 07:14 AM
#3
Thread Starter
Lively Member
Re: My procedure DetermineCardPath
I typed this game from a book of BASIC games, I typed it in QBasic and it worked, I'm trying to reporgram it with more modern way by using simple classes, I don't know much about OOP, but I've problem in the procedure I told you about when I put an object of that class in it, VB6 gave me an error message.
The original game code:
Code:
10 Rem *** GAME OF ACEY-DUCEY WRITTEN BY BILL PALMBY
20 Rem *** ADLAI STEVENSON HIGH SCHOOL, PRAIRE VIEW, ILL
30 Rem *** TRANSLATED TO RSTS/E BY DAVE AHL, DIGITAL
100 Randomize Timer
101 Print "ACEY-DUCEY IS PLAYED IN THE FOLLOWING MANNER:"
102 Print "THE DEALER (COMPUTER) DEALS TWO CARDS FACE UP."
103 Print "YOU HAVE THE PTION TO BET OR NOT TO BET DEPENDING"
104 Print "ON WHETHER OR NOT YOU FEEL THE NEXT CARD HAVE"
105 Print "A VALUE BETWEEN THE FIRST TWO."
106 Print "IF YOU DO NOT WANT TO BET, INPUT A 0."
110 Print
160 N = 100: q = 100
190 Print "YOU NOW HAVE"; q; "DOLLARS."
195 Print
200 GoTo 260
210 q = q + m
220 GoTo 190
240 q = q - m
250 GoTo 190
260 Print "HERE ARE YOUR NEXT TWO CARDS..."
270 A = Int(14 * Rnd) + 2
280 If A < 2 Then GoTo 270
290 If A > 14 Then GoTo 270
300 b = Int(14 * Rnd) + 2
310 If b < 2 Then GoTo 300
320 If b > 14 Then GoTo 300
330 If A >= b Then GoTo 270
350 If A < 11 Then GoTo 400
360 If A = 11 Then GoTo 420
370 If A = 12 Then GoTo 440
380 If A = 13 Then GoTo 460
390 If A = 14 Then GoTo 480
400 Print A
410 GoTo 500
420 Print "JACK"
430 GoTo 500
440 Print "QUEEN"
450 GoTo 500
460 Print "KING"
470 GoTo 500
480 Print "ACE"
500 If b < 11 Then GoTo 550
510 If b = 11 Then GoTo 570
520 If b = 12 Then GoTo 590
530 If b = 13 Then GoTo 610
540 If b = 14 Then GoTo 630
550 Print b
560 GoTo 650
570 Print "JACK"
580 GoTo 650
590 Print "QUEEN"
600 GoTo 650
610 Print "KING"
620 GoTo 650
630 Print "ACE"
650 Print
660 INPUT "WHAT IS YOUR BET"; m
670 If m <> 0 Then GoTo 680
675 Print "CHICKEN!!": Print
677 GoTo 260
680 If m <= q Then GoTo 730
690 Print "SORRY, MY FRIEND, BUT YOU BET TOO MUCH"
700 Print "YOU HAVE ONLY"; q; "DOLLARS TO BET."
710 GoTo 650
730 c = Int(14 * Rnd) + 2
740 If c < 2 Then GoTo 730
750 If c > 14 Then GoTo 730
760 If c < 11 Then GoTo 810
770 If c = 11 Then GoTo 830
780 If c = 12 Then GoTo 850
790 If c = 13 Then GoTo 870
800 If c = 14 Then GoTo 890
810 Print c
820 GoTo 910
830 Print "JACK"
840 GoTo 910
850 Print "QUEEN"
860 GoTo 910
870 Print "KING"
880 GoTo 910
890 Print "ACE"
910 If c > A Then GoTo 930
920 GoTo 970
930 If c >= b Then GoTo 970
950 Print "YOU WIN!!!"
960 GoTo 210
970 Print "SORRY, YOU LOSE."
980 If m < q Then GoTo 240
1000 Print
1010 Print "SORRY, FRIEND, BUT YOU BLEW YOUR WAD."
1020 INPUT "TRY AGAIN (YES OR NO)"; A$
1030 If A$ = "YES" Then GoTo 110
1040 Print: Print "O.K. HOPE YOU HAD FUN!!"
1050 End
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|