I have a terain.dat file that contains this matrix:
10 1 1 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 12 12 12 1 2 3 4 5 6 7 12 12 12 1 2 3 4 5 6 7 12 12 12
I want to read in the file and use the first number in the first line as the size of the matrix (in this case it is 10 X 10). And then fill in the 10 X 10 matrix with the numbers below.
this is what i have so far:
class Terrain def initialize file_name @input = IO.readlines(file_name)
I was wondering if the 10X10 matrix would do this and how to fill it?
user1027502
source share