I am developing a BlackJack game using Java, and it came to a point that I am using instanceof operator to determine if it is a type of some subclass.
Here's an example.
public void checkForBlackJack(Player player) {
Hand fHand = player.getHands().get(0);
if (fHand.getCardScore() == 21) {
fHand.setBlackjack(true);
}
if(player instanceof BlackJackPlayer){
BlackJackPlayer bjplayer = (BlackJackPlayer) player;
if(bjplayer.isSplit()){
//Check the users other hand if it is already blackjacked
}
}
}
Is using instanceof considered to be bad for such example? and just an overview here is my class diagram

I decided to use instanceof to check for blackjack , is because The Dealer can also blackjack.
instanceofby implementing the visitor pattern. But this would be a bit over-engineered in your case. – user714965 Oct 30 '12 at 10:46