store array of arrays in array of arrays
I'm having this problem with a chess program I'm writing.
I have multiple functions where I need to store the drawing (which is an array of arrays of Pieces(eight by eight, as is a chess board), each of them instances of class Piece), in a temporary drawing, via:
Then I do some maths on Drawing, say try all possible moves and check if it king is being attacked after each movement, and when I'm finished doing the checks,
temporarydraw = Drawing;
This restores the original Drawing, so I could do any moves, and get the old drawing back.
Drawing = temporarydraw;
I do this, and not just do the checks in temporarydraw itself, because I have some other functions that only work on Drawing, and don't work on any other drawing. (please don't ask me why)
Every function that has this code in it, leave the changes I make, and don't restore the original Drawing.
So here's my actual question: can I just save an array of arrays of Pieces into another array of arrays of pieces? (FYI: I double-checked, they are both created as an eight-by-eight array of pieces, no mistakes there)
Please help fast, I need this project finished by tomorrow night.