There’s a problem I’ve been fighting since last week. Check this piece
of code out and tell me what’s wrong:
snip
@curLen.downto(1) do |i|
@snake[i].x = @snake[i - 1].x
@snake[i].y = @snake[i - 1].y
end
snip
@curLen is an integer with the value 20 and @snake is an array
containing structures for defining coordinates. The snippet above is a
part in a snake-clone where the element 0 in array @snake is the head
which is feeded with new values each cycle. This piece of code
controls the flow of coordinates for each point of the snake.
Every time I run this code Ruby dies with no message at all.
Help, please!
-Johan Persson