Index: [thread] [date] [subject] [author]
  From: Justin Caton <jmc10@duke.edu>
  To  : 
  Date: Wed, 24 Mar 1999 00:28:31 -0500

Re: strategies

>I'd also recommend that if you consider the winning score relevant to
your
>strategy, that you use the variable PigGame.WINNING_SCORE rather than
the
>hardcoded number (100)...

Yeah that would work but the PigPlayer class should work with
any implementation i.e. it should be able work with some class
other than the PigGame class.  Being dependent on PigGame's
static int's seems like bad design.

If the player doesn't know the total then he could be rolling and
risking
getting 1's when he has already won.  This demonstrates the problem
of splitting up the design between the two classes.

Deep Thoughts (by Justin Caton):
It seems that overall the details of the game are being split between
the PigGame class and the PigPlayer class.  The PigGame class determines

when the game ends i.e. 100 points but the PigPlayer class must control
the rules (1&1 and the score resets etc.)  The Player shouldn't be
enforcing
the rules the Game should.  The Game class should tell the player his
situation
and the player should respond to the game class with a "yes roll again"
or a
"no end this turn" after all that is the only decision that the player
should have
to make.

-- Justin Caton




Index: [thread] [date] [subject] [author]