S
Sean Murphy
All,
A newby question, only been using Ruby for about 2 days.
Is there a better way of creating a two dimention array, than the code used
below
def create_world x, y
row = Array.new
y.times {
|j|
col = Array.new
x.times {
|i|
map_type = rand(2)
col = map_type
}
row[j] = col
}
return row
end
world = create_world(gets.to_i, gets.to_i)
Also, what is the best method of accessing the syslog file within Linux? I
could open the file for reading, but I want to make sure there isn't a
better method first.
Regards
Sean Murphy
Skype: smurf20005
Life is a challenge, treat it that way.
A newby question, only been using Ruby for about 2 days.
Is there a better way of creating a two dimention array, than the code used
below
def create_world x, y
row = Array.new
y.times {
|j|
col = Array.new
x.times {
|i|
map_type = rand(2)
col = map_type
}
row[j] = col
}
return row
end
world = create_world(gets.to_i, gets.to_i)
Also, what is the best method of accessing the syslog file within Linux? I
could open the file for reading, but I want to make sure there isn't a
better method first.
Regards
Sean Murphy
Skype: smurf20005
Life is a challenge, treat it that way.