From: Mason Kelsey Date: 2009-09-07T23:38:25+09:00 Subject: Re: Two Dimensional Arrays in Ruby? --001485f6da163517ef0472fdcde6 Content-Type: text/plain; charset=ISO-8859-1 Your helpfulness is appreciated. Unfortunately at age 68 my eyesight is not what it used to be. It works fine when I insert to missing comma. Ah! Programming is a young person's game. anarray = [[1, 2, 3], [4, 5, 6], [7, 8, 0]] puts anarray[1][1] puts anarray[0] puts anarray[2][0] produces (SciTE) >ruby test_2_dimensional_array.rb 5 1 2 3 7 >Exit code: 0 I'm writing a move method for the 8-puzzle problem for my artificial intelligence class and need a two dimensional way of representing the positions of the tiles. Again, thanks. No Sam On Sun, Sep 6, 2009 at 11:23 PM, Harry Kakueki wrote: > > Mon, Sep 7, 2009 at 12:11 PM, Mason Kelsey > wrote: > > > anarray = [[1, 2, 3], [4, 5, 6] [7, 8, 9]] > > puts anarray[1][1] > > Try adding a comma between the second and third array. :) > anarray = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] > > Harry > -- > A Look into Japanese Ruby List in English > http://www.kakueki.com/ruby/list.html > > --001485f6da163517ef0472fdcde6--