white turns to blue
blue turns to red
red turns to aquamarine
but green stays the same
People from StackOverflow might appreciate this one.
Puzzling Stack Exchange is a question and answer site for those who create, solve, and study puzzles. It only takes a minute to sign up.
Sign up to join this communitywhite turns to blue
blue turns to red
red turns to aquamarine
but green stays the same
People from StackOverflow might appreciate this one.
There's no actual question here, but the transform involves
Parsing the colours as HTML hex values. Valid characters are going to be the numbers 0-9 and letters a-f. Everything else will be treated as 0. This would be how some browsers interpret bad or erroneous input, treating it as 0.
Converting the words, and padding out to a length of 3 or 6 characters:
white -> #0000e0
blue -> #b00e00
red -> #0ed
green -> #00ee00
Now the colour that each represents in (red, green, blue) format is
white -> (0%, 0%, 88%) Blue
blue -> (69%, 0%, 5%) Red
red -> (0%, 93%, 87%) Aquamarine
green -> (0%, 93%, 0%) Green
This must be about RGB. So I reformulate the task as such:
f(1,1,1) = (0,0,1)
f(0,0,1) = (1,0,0)
f(1,0,0) = (0,1,1)
f(0,1,0) = (0,1,0)
Note: aquamarine = green+blue aka cyan = (0,1,1)Then the question becomes what is "f"?
Thinking further in terms of separate bits, and how we can obtain output bits from input bits:
So, finally:
output bit3 = bit1
output bit2 = bit1 xor bit2
output bit1 = not (bit1 or bit2)
Note: this uses logical or, not and xor.
f(bit1, bit2, bit3) = (not (bit1 or bit2), bit1 xor bit2, bit1)
P.S. This is just one of possible solutions, there are others and possibly more elegant ones.