You can use the stack memory to store colored square nodes and write them into empty square nodes. As the name suggests, the memory works as a stack, so the last node you add will be the first one to come out when you need to rewrite a node.
#indiegame #gamedev #puzzlegame