Hi,

do yourself the favour and make your code more readable.

UNTESTED.

Am Mittwoch, 28. Okt 2009, 12:25:41 +0900 schrieb Brian Geds:
> # dice face rows
>
> frame  = "+-----+\n"
> blank  = "|     |\n"
> center  = "|  *  |\n"
> left = "|*    |\n"
> right = "|    *|\n"
> both = "|*   *|\n"

  FRAME  = "+-----+"
  BLANK  = "|     |"
  CENTER = "|  *  |"
  LEFT   = "|*    |"
  RIGHT  = "|    *|"
  BOTH   = "|*   *|"

> # dice faces
>
> one    = frame + blank + center + blank + frame
> two = frame + left + blank + right + frame
> three = frame + left + center + right + frame
> four = frame + both + blank + both + frame
> five = frame + both + center + both + frame
> six = frame + both*3 + frame
> weird  = frame + blank*3 + frame
> faces = [one, two, three, four, five, six]

  FACES = [
    [ BLANK, CENTER, BLANK],
    [ LEFT , BLANK , RIGHT],
    [ LEFT , CENTER, RIGHT],
    [ BOTH , BLANK , BOTH ],
    [ BOTH , CENTER, BOTH ],
    [ BOTH , BOTH  , BOTH ],
  ]

  FACES.map! { |a| ([ FACES] + a + [ FACES]).map { |x| x + $/ }.join "" }
  # As it's a constant it is only evaluated once.

> points = 0
> puts 'Would you like the roll or pass?'
> user_turn = gets.chomp()

`gets' may return nil (EOF == Ctrl-D).

> while (user_turn != 'pass') do
>   result1= faces[(rand(6))]
>   result2= faces[(rand(6))]
>   puts result1
>   puts result2
>   puts 'current score is'
>   if (result1  result2 != faces[0])
>   puts 'Would you like to roll again?'
>   user_turn = gets.chomp
> end
> end

Argh. Indent the `if' correctly.
Just call `gets' in one place.

You should store and compare the _number_ of resulting eyes but
not the whole image.  That's just for displaying.

Then the problem will be obvious, I bet.

Bertram


-- 
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-scharpf.de