AI learns the “differences” between two items with exclusive OR (XOR).
AI learns the differences between the three "colors" by training with a neural network with three inputs.

You can experience the principle of artificial intelligence with basic neural network: multilayer perceptron (mlp).