loganjspears/Poker — Issue #1: Player Subclasses vs. Relationship
Author: loganjspears
Created: 2012-03-04 04:59:29+00:00
State: open

Subclasses:
By making new "HandPlayers" the constructor takes all the values from the "TablePlayer"and copies them into the new HandPlayer object. This works nicely for things like accessing the name, but it is a pain because you no longer have an actual reference to the original "TablePlayer". This means that if anything about the "TablePlayer" is modified then it won't be retained by the actual TablePlayer that doesn't get killed every hand.

Relationships:
This solves the problem with not having reference to the actual TablePlayer, but it makes things like handPlayer.getName() turn into handPlayer.getTablePlayer().getPlayer().getName() because you would have to form a PlayerToTable relationship as well as TablePlayerToHand relationship.

Updating the TablePlayer after each hand wouldn't work either because values such as tableBankroll are held by the table and do fluctuate during the hand.