Sequence Scripting

So, currently I am working on a game that uses a 3x3 grid. Like so:




nodes 1 through 9 are all in the off setting. each have a total of 4 colors (off, yellow, green and purple)

I am trying to write a script that allows the computer (AI) to select a sequence of the buttons that the player will have to follow within a certain amount of time from the computer finishing the sequence the colors don’t matter in this situation (i just let you know of the colors showing there are multiple states for the buttons. I found some information on how to script a Simon Says game (the one with one unit and 4 color plates but that doesn’t really resolve my situation let alone tell me where to even start.

Is it possible/plausible for me to write a script that will destroy the nodeOff gameObject and instantiate one of the other colors as a prefab? Is this efficient? What would be a best practice in this situation? How would I tackle this as a beginning programmer?

Thank you so much!

I ended up using a series of if statements and ray casts to really work the AI and then I attached it to a game manager GO. Instead of different colored blocks I also used area lights for a much better effect. I am still interested in how other people may have gone about doing this!