Amos King
10/13/2006 1:46:00 PM
With the ace all you have to do is check to see if the total hand
values is going to be > 21 with the ace as 11 if so the ace will
become 1. The issue is when the ace is in the hand and you hit again.
It's value could change.
On 10/12/06, Gavin Kistner <gavin.kistner@anark.com> wrote:
> From: Jeremy Woertink
> >
> > I do have another question. I want to do something to set the point
> > values of the cards, I'm not quite sure how to go about doing so.
> > I did come up with
> > def points
> > if @value == 'Jack' then 'Jack' = 10,
> > @value == 'Queen' then 'Queen' = 10,
> > @value == 'King' then 'King' = 10,
> > @value == 'Ace' then 'Ace' = 11 unless @player.player_hand > 10
> > end
> > end
> > but, this code doesn't work. I was thinking it would work similar to
> > this. If you or anyone else has any ideas please let me know. thanks.
>
> To start you off:
>
> def points
> case @value
> when '2'..'9'
> @value.to_i
> when 'ace'
> 11
> else
> 10
> end
> end
>
> I think you'll have trouble with the ace, though:
> In order to determine the value of the ace, you need to know the value
> of the whole hand.
> In order to determine the value of the whole hand, you need to know the
> value of the ace.
> In order to determine the value of the ace, ...
>
>
>
>
--
Amos King
USPS
Programmer/Analyst
St. Louis, MO