Click here to Skip to main content
15,908,634 members

Comments by JLSto (Top 6 by date)

JLSto 9-Feb-15 2:36am View    
Hi there, thanks for your reply, I haven't had much time to look at the link, been very busy with work, So its basically just the same as creating your own, except you don't have to do all the typing ?
JLSto 14-Apr-14 17:33pm View    
I need a little more help, I am nearly done and I have figured out how to display the randomly generated cards, but I now need to calculate the players score in the player class but im not to sure what I can do here, I need to retrieve the randomly selected card value that was stored ... I have just sent the relevant code.

This is my deck class...


Public Class Deck

Dim c As Card = New Card()


Dim deckOfCards As List(Of KeyValuePair(Of String, Integer))


Public Function RandomCards(ByVal min As Integer, ByVal max As Integer) As Integer


Static generator As System.Random = New System.Random()

Return generator.Next(min, max)
End Function

Public Function dealCard()
Dim card As String
Dim scoreValue As Integer
deckOfCards = c.cardValues()


Dim ranCard As Integer = RandomCards(0, deckOfCards.Count - 1)


card = deckOfCards(ranCard).Key

' I declared this for the sake of returning in to the calculateScore value but im really not to sure what im doing.
scoreValue = deckOfCards(ranCard).Value



Return card
End Function
End Class


And this is my player class...


Public Class Player


Public playerScore As Integer = 0
Public wins As Integer = 0
Public losses As Integer = 0
Public ties As Integer = 0

Public Function calculateScore(ByRef scoreVale As Integer)
Dim randCard As Integer
randCard = "This needs to be the randomly selected cards value that was stored in the 'KeyValuPpare'"


playerScore += randCard
Return playerScore

End Function
End Class
JLSto 11-Apr-14 11:24am View    
Thanks that was very helpful, and I enjoyed your explanations.
JLSto 11-Apr-14 7:45am View    
Thanks a lot man, this really helps me a lot, there is a bit more I would like to ask, but first I just want to thank you for helping me and giving me good criticism and not just turning away.
so here goes my questions...

1. how would I link my different images to each card (eg. 0 : SpadeAce : 11) how would I link the ace card image to this ?

If you could help it would be great, maby evan an email ?
JLSto 18-Feb-14 7:20am View    
Thank you very much for your time, ill give that tutorial a go and let you know how things go