68
6
In the card game Magic: the Gathering there are five different colours, which represent loose affiliations of cards, White (W
), Blue (U
), Black (B
), Red (R
) and Green (G
). These are often arranged in a pentagon as follows:
W
G U
R B
Both in the lore of MtG as well as in many card mechanics, adjacent colours in this pentagon are usually considered allies, and non-adjacent (sort of opposite) colours are considered enemies.
In this challenge, you'll be given two colours and should determine their relationship.
The Challenge
You're given any two distinct characters from the set BGRUW
. You may take these as a two-character string, a string with a delimiter between the characters, two separate character values, two singleton strings, two integers representing their code points, or a list or set type containing two characters/strings/integers.
Your output should be one of two distinct and consistent values of your choice, one which indicates that the two colours are allies and one which indicates that they are enemies. One of those two values may be no output at all.
You may write a program or a function and use any of the our standard methods of receiving input and providing output.
You may use any programming language, but note that these loopholes are forbidden by default.
This is code-golf, so the shortest valid answer – measured in bytes – wins.
Test Cases
There are only 20 possible inputs, so I'll list them all.
Friends:
WU UB BR RG GW UW BU RB GR WG
Foes:
WB UR BG RW GU BW RU GB WR UG
33Up next: implement the core rules :P – Captain Man – 2017-03-14T14:56:09.900
12@CaptainMan i will upvote you if you can make it fit in a 30k character post :) – Walfrat – 2017-03-14T15:58:30.747
@Walfrat 30k? Should be possible – Not that Charles – 2017-03-15T21:03:56.287
(offtopic) This separation seems strange to me, kind of an artificial limit on amount of combinations for decks. For instance, Blue-Green Simics and Black-White Orzhov both feel organic and kick ass. :) – Ivan Kolmychek – 2017-03-16T15:10:23.597
2@IvanKolmychek from the most unexpected alliances comes the most unexpected outcomes. – aluriak – 2017-03-19T01:59:47.433
1Fun fact: Magic: The gathering is turing complete :) – Matthew Roh – 2017-03-20T08:04:30.167