# Re: New to ruby questions

**URL:** <https://www.ruby-forum.com/t/re-new-to-ruby-questions/72630>\
**Category:** Ruby\
**Created:** [October 18, 2006, 10:39am UTC](https://www.ruby-forum.com/t/re-new-to-ruby-questions/72630 "2006-10-18T10:39:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [October 18, 2006, 10:39am UTC](https://www.ruby-forum.com/t/re-new-to-ruby-questions/72630/1 "2006-10-18T10:39:31Z")

</div>

From: Jeremy W.

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

---

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [October 18, 2006, 10:40am UTC](https://www.ruby-forum.com/t/re-new-to-ruby-questions/72630/2 "2006-10-18T10:40:56Z")

</div>

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.
