imroadkill2 Posted May 29, 2006 Report Share Posted May 29, 2006 (edited) -Removed- Edited February 1, 2012 by imroadkill2 Quote Link to post Share on other sites
imroadkill2 Posted May 29, 2006 Author Report Share Posted May 29, 2006 (edited) -Removed- Edited February 1, 2012 by imroadkill2 Quote Link to post Share on other sites
shanenin Posted May 29, 2006 Report Share Posted May 29, 2006 nice job :-) Quote Link to post Share on other sites
iccaros Posted June 4, 2006 Report Share Posted June 4, 2006 (edited) my only suggestion would be to use more arrays.an array of cards values (I count 0 - 12) and then create a array of cards 2 - A then an array of types (H,S,C,D)you could then get rid of this If DealPlayer1NewCard(i) = 1 Then Randomize() type = (Rnd() * 3) + 1 If type = "1" Then suitPlayer1(i) = "h.bmp" If type = "2" Then suitPlayer1(i) = "d.bmp" If type = "3" Then suitPlayer1(i) = "c.bmp" If type = "4" Then suitPlayer1(i) = "s.bmp" Randomize() cardPlayer1(i) = (Rnd() * 12) + 2 player1CardPicture(i) = cardPlayer1(i) & suitPlayer1(i)and just store the number to a array for look up later. no need for if statements just use the array you stored numbers into as the place for the type arraysomething like this when you want to re look upcardtype = cardtypearray(typearray(i))I don't know much of anything about VB but object would make this nice, and so would funtions.. you repeat the same things over and over.. is there a funtion (method) system in VB?things like checking what is in player ones hand or player two hand should use the same code, just pass a diffrent array for each hand.. with a return of what they havewith object it looks like this if (check_hand(playerone) > check_hand(player2))Then {out put..........} ELSE{outPut....}this would check the return value of sending playerones hand to the check_hand funtion aginst the return of sending player twos hand sent to the check_hand funtions..I rember gosubs in basic.. but as I said.. I am VB stupid... if I confused you I'm sorry..in java we would do some thing like thispublic static enum Face {Ace, Deuce, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King};this gives us a two way look up, any random number = 0 = Ace. also Ace = 0 in valuesame with Suitpublic enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES }which for you could be public enum Suit { C.bmp, D.bmp, H.bmp, S.bmp } Edited June 4, 2006 by iccaros Quote Link to post Share on other sites
naraku9333 Posted June 5, 2006 Report Share Posted June 5, 2006 I agree with Iccaros about splitting the code up into sub-procedures. It would be far more efficient to write (and read). Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.