What strategy to allocate resources while respecting many constraints

this should prevent sequences like:
G-G-G, G-N-G, N-GN-G, N-N-N, etc…

this should prevent sequences like:
N-G, N-GN, GN-G, GN-GN (so some constraints must be added)
But, I don’t understand why, it doesn’t seem to work for the set constraints either