Help defining multi-dimensional array

V

Victor Reyes

------=_Part_16782_1298035.1134070694364
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Ruby Team,
I would like to define a 3x3 array of integers.
Can anyone tell me how this is done?
I would like to start playing with Ruby and I want to start by solving Magi=
c
Squares.

Thank you

Victor

------=_Part_16782_1298035.1134070694364--
 
J

James Edward Gray II

Ruby Team,
I would like to define a 3x3 array of integers.
Can anyone tell me how this is done?

Here's one way:
=> [[0, 0, 0], [0, 0, 0], [0, 0, 0]]

Hope that helps.

James Edward Gray II
 
V

Victor Reyes

------=_Part_17086_9203740.1134071803183
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

This was quick.

Thank you

Ruby Team,
I would like to define a 3x3 array of integers.
Can anyone tell me how this is done?

Here's one way:
=3D> [[0, 0, 0], [0, 0, 0], [0, 0, 0]]

Hope that helps.

James Edward Gray II

------=_Part_17086_9203740.1134071803183--
 
D

Dan Diebolt

--0-1016370276-1134076399=:81371
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

#Third Order Magic Cube
b=3D{}
b["0,0,0"]=3D1
b["0,0,1"]=3D15
b["0,0,2"]=3D26
b["0,1,0"]=3D17
b["0,1,1"]=3D19
b["0,1,2"]=3D6
b["0,2,0"]=3D24
b["0,2,1"]=3D8
b["0,2,2"]=3D10
b["1,0,0"]=3D23
b["1,0,1"]=3D7
b["1,0,2"]=3D12
b["1,1,0"]=3D3
b["1,1,1"]=3D14
b["1,1,2"]=3D25
b["1,2,0"]=3D16
b["1,2,1"]=3D21
b["1,2,2"]=3D5
b["2,0,0"]=3D18
b["2,0,1"]=3D20
b["2,0,2"]=3D4
b["2,1,0"]=3D22
b["2,1,1"]=3D9
b["2,1,2"]=3D11
b["2,2,0"]=3D2
b["2,2,1"]=3D13
b["2,2,2"]=3D27

=09
 
A

ara.t.howard

Ruby Team,
I would like to define a 3x3 array of integers.
Can anyone tell me how this is done?
I would like to start playing with Ruby and I want to start by solving Magic
Squares.

Thank you

Victor

check out narray - i think the functionality of it will help greatly.

-a
--
===============================================================================
| ara [dot] t [dot] howard [at] noaa [dot] gov
| all happiness comes from the desire for others to be happy. all misery
| comes from the desire for oneself to be happy.
| -- bodhicaryavatara
===============================================================================
 
V

Victor Reyes

------=_Part_9370_19969324.1134276710557
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Thank you all for your help.

Ruby Team,
I would like to define a 3x3 array of integers.
Can anyone tell me how this is done?
I would like to start playing with Ruby and I want to start by solving Magic
Squares.

Thank you

Victor

check out narray - i think the functionality of it will help greatly.

-a
--

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D
| ara [dot] t [dot] howard [at] noaa [dot] gov
| all happiness comes from the desire for others to be happy. all misery
| comes from the desire for oneself to be happy.
| -- bodhicaryavatara

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D

------=_Part_9370_19969324.1134276710557--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top