Copying a List of Lists in c#
So i have a List of Lists of class objects, that i use to represent a game-board. I am trying to build an AI, that, on first steps of its work, will construct a game tree out of the game-board. By sending the List of Lists to the function, the AI tries to push game pieces here and there to check where it can go, thus changing the List of Lists i send to the function. However, due to my recent realization, Lists are references and thus when AI changes some values, the real GameBoard also gets changed. Furthermore, when tree is built, changing one node changes entire tree. That is all because, all Nodes are pointers to same objects. I have googled for ways how to efficiently come a list and thus get a new board, but all of the methods i tried still result in all nodes being the pointers to same object, mainly probably because they are intended for Lists, not List of List. So my question is, how do i make a copy of List of Lists and thus get a new object, instead of new references to said object?
Your answer
Follow this Question
Related Questions
Loop back to beginning of list in monopoly style game 1 Answer
Most efficient way to store information in an inspector dropdown menu? 0 Answers
How to create a Matrix / Array / List / Grid of gameObjects? 1 Answer
check if a list contains the same id as in another list 1 Answer
Array with pushing values? 0 Answers