c# - Copying a smaller array into a larger one -
I am struggling to think of the most elegant / simple way of doing this. Maybe I'm thinking it upside down.
Let's say I have a 5x5 array that looks like this:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 And another 2x2 array that looks like this:
5 1 2 3 I want to select a location in the 5x5 array, say [2] [2], and keep the values from the second array in advance, then it looks like:
0 0 0 0 0 0 0 0 0 0 0 5 1 0 0 0 2 3 0 0 0 0 0 0 To set the number of rows / columns in the array to copy my initial idea For the A loop was to be used, but in the morning to do this in my head, I can not seem to have a puzzle in a way.
Any suggestions?
Edit:
Sorry, the way I'm currently doing it. Just wondering what a better way is.
It's really a matter of unity that I am part of - "Room Deers" is our small array, and the "map" is moving into that large array it is a random map generator Is a part of what needs to be told that there are doors on the "edges" of tiles in the room, which can connect to other rooms. The roomydor stores 4 booleans, tells me for a direction that if there is a door.
room dors = last room.getcompanent
line
map [10, 10 ] = Room Dodge [0, 0];
is redundant, because the same work will be done by the first iteration of the loop. Removing the line leads to a solution that is smaller and more efficient.
Comments
Post a Comment