[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: New to ruby questions

Gavin Kistner

10/12/2006 10:03:00 PM

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, ...



4 Answers

Amos King

10/13/2006 1:46:00 PM

0

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

Connie M. Enright

9/13/2013 1:57:00 AM

0

'Lickin' Ass and Fakin' Military Service' is a Proven Fraud, a Proven
Liar, a Proven Thief, and recently a Proven Malicious Poster. She is
the most prolific liar in this newsgroup and also the most prolific
thief of other's writings. She is also a Stolen Valor stain on
America.

'Lickin' Ass and Fakin' Military Service' IS the Democratic Party in
America. She is an admitted election official in VA. This is proof
positive that DemocRATs are the party of Liars, Frauds & Thieves.

Note that when you reply to a Proven Liar you encourage them to
continue lying.

[][][][][][]


The DemocRATs Hall Of Shame asks "Why do you always LIE?"

[Courtesy of Buster Norris]

On Mon, 25 Jun 2012 16:49:25 -0400, Kickin' Ass and Takin' Names
<PopUlist349@hotmail.com> wrote:
>Todd Palin has designated his charity as the Armed Services Y MCA of
>Alaska as his designated charity to benefit, should he win.
>However, make no mistake. This Armed Services YMCA is not a charity
>close to Todd?s heart. The web site of the YMCA in Anchorage doesn?t
>list Todd or Sarah Palin as a donor.

LIAR!!!!!!!!!!!!!!!!!!!!!!!!

They only list major corporate donors................

http://www.asymca.org/about/sponsors-par...

>The director of the YMCA, Diana Frayne

LIAR!!!!!!!!!!!!!!!!!!!!

Diana Frayne - Deputy Director
http://www.asymcaofalaska.com/whoweare/board...

Posted on behalf of:
The DemocRATs Hall of Shame!

Isabelle Amparo Juarez-Bryant

9/13/2013 1:57:00 AM

0

"Denny" is a Socialist-Communist Troll, a moderately retarded fool,
and a poor liar.

From: dzweibach@REMOVEyahoo.com (Denny)
X-No-Archive: yes

----------
Everything you need to know about 'Denny':
>Bret Cahill <BretCahill@peoplepc.com> wrote:
>> Holder needs to go after W. Bush & Cheney for using the IRS against
>> anti-quagmire activists and after they are safely behind bars then
>> we'll discuss Obama.
>...Those two have problems enough. We've all heard the rumors...Screaming
>nightmares, heavy drug use...leave them alone, let them suffer. Every time
>one of them see a Wounded Warrior ad on TV, their handlers have to hit them
>with the needle.
>MAY EVERY WAR-SUPPORTING RIGHT-WINGER SUFFER THE SAME.
[Emphasis mine - PG.]
----------

"Denny" posts a lot like a new version of that old brain-damaged idiot
"Ray Fischer."

Please note that when you reply to a Liar you encourage them to
continue lying.

[][][][][][]
The DemocRATs Hall Of Shame asks "Why do you always LIE?"

[Courtesy of Buster Norris]

On 02 Sep 2013 15:11:48 GMT, dzweibach@REMOVEyahoo.com (Denny) wrote:
>The many
>Republicans down there says beach erosion is due to the hurricaines.
>Stupids.

LIAR!!!!!!!!!!!!!!!!!!!!!!!!!!

Erosion is caused by many natural and man-made problems. Some erosion
results from the very slow rise of the sea level. Another big natural
factor is weather. Hurricanes, tropical storms, and other strong
weather systems play largerly into beach erosion. Coastal Development
that is not well thought out can also wreck havoc on the coastline.
Construction projects can cause trapping of sand which removes it from
the normal flow out and flow in of sand. This can be a major cause of
beach erosion. Erosion is an issue around the whole coast of Florida
but 5 percent of it is at critical levels.
http://www.foundationprosfl.com/florida_beach_er...

Posted on behalf of:
The DemocRATs Hall of Shame!

Dedra Burrell

9/13/2013 1:57:00 AM

0

'Lickin' Ass and Fakin' Military Service' is a Proven Fraud, a Proven
Liar, a Proven Thief, and recently a Proven Malicious Poster. She is
the most prolific liar in this newsgroup and also the most prolific
thief of other's writings. She is also a Stolen Valor stain on
America.

'Lickin' Ass and Fakin' Military Service' IS the Democratic Party in
America. She is an admitted election official in VA. This is proof
positive that DemocRATs are the party of Liars, Frauds & Thieves.

Note that when you reply to a Proven Liar you encourage them to
continue lying.

[][][][][][]


The DemocRATs Hall Of Shame asks "Why do you always LIE?"

[Courtesy of Buster Norris]

On Mon, 25 Jun 2012 16:49:25 -0400, Kickin' Ass and Takin' Names
<PopUlist349@hotmail.com> wrote:
>The Ex-First Dude has marketed himself as a fisherman, a snowmobile

AWWWWWWWWWWWWWWWWWWWWWWWWWWWW!!!!!!!!!!!!!!!!!!!!!!!!!!!

Did you think you'd get away with STEALING that???????????

HAAAAAAAAAAAAAAAAAAAAA!!!!!!!!!!!!!!!!!!

You STOLE it from here:

http://malialitman.wordpress.com/2012/06/25/the-reality-of-t...

Posted on behalf of:
The DemocRATs Hall of Shame!