Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Dealing with cards in a deck  RSS feed

 
Shawn Gordian
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following code and what I want to figure out is when I deal out the card and face them down I want to take the top card and show its value and suit. I already know how to deal the cards to the players and flip the cards. Just need help/advice on showing that card.


Here is deck class


Here is card class


Here is where my problem is
 
Junilu Lacar
Sheriff
Posts: 11125
160
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The player's cards are in the hand array right? Which element of that array represents the top card? Then doesn't a card have a toString() method?

Why are you doing this in the Player constructor?

This code is saying "The player will initially have a hand with 26 blank Cards".

Did you really mean to do that? If this were a real card game and you dealt me a hand with 26 blank cards, I'd be all

Lastly, while it's admirable that you are trying to write JavaDocs, you should read this document: http://www.oracle.com/technetwork/articles/java/index-137868.html so you know how to write them properly. When it comes to JavaDocs, you should conform to the conventions given in that document and yours don't.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!