Well, it's really not a code so much as a game.
Any time you click on a light, it will move one space or jump over one and only one light of the opposite color.
Red lights can only move down, and green lights can only move up.
A bit of logic combined with trial and error should make this puzzle fairly easy to solve.