On Thu, Sep 29, 2011 at 9:53 PM, Rob V. <robtvogel / gmail.com> wrote:
> The ["ah"] was a typo, it was supposed to be ["Ah"] I attached the file.
>
> Attachments:
> http://www.ruby-forum.com/attachment/6639/deal.rb

OK, got it. If you add these lines:

p player1
p player1.first

after the 2.times loop, you will see that they print this (p is
outputting the inspect method, it's like puts player1.inspect):

[["7d"], ["10c"]]
["7d"]

So, as I guessed, player1 is a nested array. player1.first is an
array, not the string. The reason is that the take method returns an
array:

irb(main):006:0> a = [1,2,3,4,5]
=> [1, 2, 3, 4, 5]
irb(main):007:0> a.take(1)
=> [1]
irb(main):008:0> b = []
=> []
irb(main):009:0> b.push(a.take(1))
=> [[1]]

You don't need the nesting. Instead of using take I'd use pop, which
by the way also removes the element (you are doing that with
delete_at):

2.times do
  player1.push shuffle.pop
  dealer.push shuffle.pop
end

After that change,

p player1
p player1.first
p deck[player1.first]

print:
["Jh", "4h"]
"Jh"
10

which is what you want.

Hope this helps,

Jesus.