Explanation of solution to finding if input contains all 4 colors
?ctm=Rainbow;Accept_if_input_contains_all_four_colors.;rgbgbrbrbgbrbgrg:x|ygbrg:*|ggrrrbyg:*|ybbbrrbyb:x|:x|brgy:*;13;3;0;
solution
You can't remove all of one color, then remove all the next because there is no way to tell once you've removed all of one color without entering a potential infinite loop. The other approach of seeing what the firt symbol is, forking for each case, would require 16 states with connections that probably make this impossible (bisqwit came close, but it didn't quite fit, and isn't fully correct yet, another error case is brgby, or any of the solo switches that want a color, but get one of the other pair colors first).
Solution:
The idea is to always make progress each time you return to the main loop (the black box). Progress is defined as removing at least one or exiting. If this holds true, it will eventually terminate. This solution is correct so long as the color removed was redudant (2 or more present) or this string lacks another color, in which case it doesn't matter what is removed since it is doomed to rightfully fail).
The blue red box is entered only when it knows a blue and a red have been encountered, likewise for the yellow green box. These just check then that the opposite two colors are present or fail if they aren't, using the brute force state method.
The blue box is entered only when a blue has been found and removed, it then adds a blue and finds the next blue or red. If a red is found, goto the blue red box (exit case). Otherwise a blue is found (impossible there there is no blue since one was added), then it is removed and we have accomplished our task for the main loop (2 blues removed, 1 added). If there were no more blues before adding one, then this loop won't exit until that same blue is found again. In this case that means there were no reds, so it is safe to fail, but we cannot not know this is the case, luckily this one blue is removed and the invariant is maintained.
The red box is the complement of the blue box.
If main loop does not encounter a red/blue, the orange box is entered. If the string is empty, we exit at the black X). Now suppose a yellow is encountered (equivalent logic for green), it is then added back, and another yellow green switch is encountered, if yellow there is net of -1 yellow, return to main loop, if green, yellow green are present, enter yellow green box. If blue, it is safe to enter the blue box which we have shown will make progress, (same for red). The last case to check for is a yellow or green followed by nothing, that same yellow that was added is then removed again in the next switch and sent back to the main loop, with progress (empty string now).
Therefore it is correct and exits.
PS: The malevolence engine is cool, now it would make sense to go for speed too (on the built in levels that is)