Alright so I have as an input, a 2D array of type Piece, and I have to basically create another 2D array with essentially the same values as what was in the original array and that will be the output (of type Piece as well). I am not allowed to just do this:
NewBoard = oldBoard;
I have a strong idea that I should make a loop, but I am not exactly sure what to do.
Do you really want to create another new array? Or do you want a reference to your existing array? If a reference to your existing array is okay, then you should be able to assign the reference...
...assuming these variables are properly declared. So why exactly do you say you are "not allowed" to use this? Is the compiler stopping you for some reason? Or is this a requirement?
If it's a requirement, and you really want a separate copy of theBoard, then you need to distinguish between a "shallow copy" and a "deep copy." That means, whether the new array will reference the same Piece objects as the original, or whether each Piece instance also needs to be copied.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
I was born with webbed fish toes. This tiny ad is my only friend: