--0016361e89ec8add510476f72ba6
Content-Type: text/plain; charset=ISO-8859-1

You need a break in your loop.  Also the conditional syntax is wrong

it should be something like:

unless result1 faces[0] or results2 faces[0]
   puts 'Would you like to roll again?'
else
   break
end

On Tue, Oct 27, 2009 at 11:25 PM, Brian Geds <uforacer / hotmail.com> wrote:

> Hello guys I am doing a little something for class but I need help
> Okay the point of the game is to roll to random dice and if the dice
> lands on [one] you lose or if you dont you get to add up the two sums of
> what you did roll. or you get the option to choose to roll again or
> pass. heres that my code looks like....it will do the while, but when it
> gets to the if(and lands on 1) it will stay in the while for some
> reason. Here is what my code looks like
>
> # roll or pass
> #
> # A Ruby dice game.  Each turn you can play it safe and keep your score,
> # or roll again to rack up points.  But watch out!  A roll of 1 could
> cost
> # you everything!
>
>
> # dice face rows
>
> frame   +-----+\n"
> blank   |     |\n"
> center   |  *  |\n"
> left  |*    |\n"
> right  |    *|\n"
> both  |*   *|\n"
> # dice faces
>
> one     rame + blank + center + blank + frame
> two  rame + left + blank + right + frame
> three  rame + left + center + right + frame
> four  rame + both + blank + both + frame
> five  rame + both + center + both + frame
> six  rame + both*3 + frame
> weird   rame + blank*3 + frame
> faces  one, two, three, four, five, six]
> points  
> puts 'Would you like the roll or pass?'
> user_turn  ets.chomp()
>
> while (user_turn ! pass') do
>  result1 aces[(rand(6))]
>  result2 aces[(rand(6))]
>  puts result1
>  puts result2
>  puts 'current score is'
>  if (result1  result2 ! aces[0])
>  puts 'Would you like to roll again?'
>  user_turn  ets.chomp
> end
> end
> --
> Posted via http://www.ruby-forum.com/.
>
>

--0016361e89ec8add510476f72ba6--