Sign in to follow this  
imroadkill2

What You Think So Far

Recommended Posts

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 array

something like this when you want to re look up

cardtype = 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 have

with 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 this

public 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 value

same with Suit

public enum Suit { CLUBS, DIAMONDS, HEARTS, SPADES }

which for you could be

public enum Suit { C.bmp, D.bmp, H.bmp, S.bmp }

Edited by iccaros

Share this post


Link to post
Share on other sites

I agree with Iccaros about splitting the code up into sub-procedures. It would be far more efficient to write (and read).

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this