text:
Magic the Gathering: Friends or Foes?
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

Up next: implement the core rules :P

@CaptainMan i will upvote you if you can make it fit in a 30k character post :)

@Walfrat 30k?  Should be possible

(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. :)

@IvanKolmychek from the most unexpected alliances comes the most unexpected outcomes.

Fun fact: Magic: The gathering is turing complete :)

JavaScript (ES6),  26 23 17 15  14 bytes
Takes input as two ASCII codes in currying syntax (a)(b). Returns 4 for friends or 0 for foes.
a=>b=>a*b/.6&4

Try it online!
How?
NB: only the integer quotient of the division by 0.6 is shown below.
Combo | a  | b  | a*b  | / 0.6 | AND 4
------+----+----+------+-------+------
  WU  | 87 | 85 | 7395 | 12325 |   4
  UB  | 85 | 66 | 5610 |  9350 |   4
  BR  | 66 | 82 | 5412 |  9020 |   4
  RG  | 82 | 71 | 5822 |  9703 |   4
  GW  | 71 | 87 | 6177 | 10295 |   4
  UW  | 85 | 87 | 7395 | 12325 |   4
  BU  | 66 | 85 | 5610 |  9350 |   4
  RB  | 82 | 66 | 5412 |  9020 |   4
  GR  | 71 | 82 | 5822 |  9703 |   4
  WG  | 87 | 71 | 6177 | 10295 |   4
------+----+----+------+-------+------
  WB  | 87 | 66 | 5742 |  9570 |   0
  UR  | 85 | 82 | 6970 | 11616 |   0
  BG  | 66 | 71 | 4686 |  7810 |   0
  RW  | 82 | 87 | 7134 | 11890 |   0
  GU  | 71 | 85 | 6035 | 10058 |   0
  BW  | 66 | 87 | 5742 |  9570 |   0
  RU  | 82 | 85 | 6970 | 11616 |   0
  GB  | 71 | 66 | 4686 |  7810 |   0
  WR  | 87 | 82 | 7134 | 11890 |   0
  UG  | 85 | 71 | 6035 | 10058 |   0

Previous approach, 15 bytes
Takes input as two ASCII codes in currying syntax (a)(b). Returns 0 for friends or 1 for foes.
a=>b=>a*b%103%2

Try it online!
How?
Combo | a  | b  | a*b  | MOD 103 | MOD 2
------+----+----+------+---------+------
  WU  | 87 | 85 | 7395 |    82   |   0
  UB  | 85 | 66 | 5610 |    48   |   0
  BR  | 66 | 82 | 5412 |    56   |   0
  RG  | 82 | 71 | 5822 |    54   |   0
  GW  | 71 | 87 | 6177 |   100   |   0
  UW  | 85 | 87 | 7395 |    82   |   0
  BU  | 66 | 85 | 5610 |    48   |   0
  RB  | 82 | 66 | 5412 |    56   |   0
  GR  | 71 | 82 | 5822 |    54   |   0
  WG  | 87 | 71 | 6177 |   100   |   0
------+----+----+------+---------+------
  WB  | 87 | 66 | 5742 |    77   |   1
  UR  | 85 | 82 | 6970 |    69   |   1
  BG  | 66 | 71 | 4686 |    51   |   1
  RW  | 82 | 87 | 7134 |    27   |   1
  GU  | 71 | 85 | 6035 |    61   |   1
  BW  | 66 | 87 | 5742 |    77   |   1
  RU  | 82 | 85 | 6970 |    69   |   1
  GB  | 71 | 66 | 4686 |    51   |   1
  WR  | 87 | 82 | 7134 |    27   |   1
  UG  | 85 | 71 | 6035 |    61   |   1

Initial approach, 23 bytes
Takes input as a 2-character string. Returns true for friends or false for foes.
s=>parseInt(s,35)%9%7<3

Try it online!

Ah, finally something fun. :)

Fantastic find!

Is there some clever maths I'm not aware of here or did you just brute force different modulos until you got one that worked?

@FourOhFour It was brute forced. I think this is the smallest double modulo solution. But a port of this answer (which is using a comparison) would actually be one byte shorter.

So basically you brute-forced the 103 module to gather results which are either odd or even, right?

@OddDev I actually tested all bits, not just the least significant one. For instance, a*b%290&8 would work just as well (producing 0 for friends or 8 for foes).

@Arnauld Interesting... Thank you! Btw, would be nice to have a blog-post or something about it :)

Jelly, 6 bytes
ạg105Ị

Takes two code points as argument. Yields 1 for friends, 0 for foes.
Try it online!
Background
Let n and m be the code points of two input characters. By taking |n - m|, we need to concern ourselves only with all 2-combinations of characters. The following table shows all 2-combinations of characters the the corresponding absolute differences.
WU  2
UB 19
BR 16
RG 11
GW 16

WB 21
UR  3
BG  5
RW  5
GU 14

All foe combinations are divisible by 3, 5, or 7, but none of the friend combinations this, so friends are exactly those that are co-prime with 3 × 5 × 7 = 105.
How it works
ạg105Ị  Main link. Left argument: n (code point). Right argument: m (code point)

ạ       Yield the absolute difference of n and m.
 g105   Compute the GCD of the result and 105.
     Ị  Insignificant; return 1 if the GCD is 1, 0 if not.

Nicely spotted! Why is the absolute value necessary? (I tried it online and it didn't give the right answer; but mathematically it shouldn't matter.)

@GregMartin It isn't necessary; signed difference would work just as well. Subtraction is _ is Jelly. Did you use something else?

Ah I see, I wrongly read ạ as just absolute value, not absolute difference.

Python 2, 19 bytes
"WUBRGWGRBUW".count

Try it online!
An anonymous function: returns 1 for friends and 0 for foes.

How does this work?

@stannius https://www.tutorialspoint.com/python/string_count.htm

Befunge-98, 13 12 bytes
~~-9%5%3%!.@

Try it online!
Prints 0 for friends and 1 for foes
This uses the difference between the ASCII values of the letters.
If we take the (((ASCII difference % 9) % 5) % 3), the values for the foes will be 0. Then, we not the value and print it.
Thanks to @Martin for the golf

Use Jelly for 9 bytes: IA%9%5%3¬ Edit Try It Online!

@JonathanAllan I see you already did! Nice.

I actually morphed your method (using the actual, rather than absolute, difference) mod 9 mod 6, and used the fact that Jelly indexes into lists modularly to get it down to 7. I accredited you and linked here.

@JonathanAllan I came up with the mod 9 mod 6 method too, but Befunge doesn't have actual difference or an absolute value, so it wasn't as feasible

Jelly, 8 7 bytes
Piggybacks off of Mistah Figgins's fabulous Befunge answer!
Iị390B¤

Try it online!
How?
As Mistah Figgins noted the decision may be made by taking the absolute difference between the ASCII values mod 9 mod 5 mod 3 - 0s are then friends and 1s and 2s are enemies.
If we instead take the (plain) difference mod 9 we find that friends are 1s, 2s, 7s, and 8s while enemies are 3s, 4s, 5s, and 6s.
The code takes the difference with I and then indexes into the length 9 list [1,1,0,0,0,0,1,1,0], which is 390 in binary, 390B. The indexing is both modular (so effectively the indexing performs the mod 9 for free) and 1-based (hence the 1 on the very left).

C++ template metaprogramming, 85 bytes
template<int A,int B,int=(A-B)%9%5%3>struct f;template<int A,int B>struct f<A,B,0>{};

less golfed:
template<int A, int B,int Unused=(((A-B)%9)%5)%3>
struct foe;
template<int A, int B>
struct foe<A,B,0>{};

As this is a metaprogramming language, a construct compiling or not is one possible output.
An instance of f<'W','B'> compiles if and only if 'W' and 'B' are foes.
Math based off Befunge answer.
Live example.
As C++ template metaprogramming is one of the worst golfing languages, anyone who is worse than this should feel shame.  ;)

Seems like there are a total of two redundant whitespaces inside templates.

@TuukkaX fixed, d'oh

Ruby, 22 19 bytes
->x,y{390[(x-y)%9]}

Input: ASCII code of the 2 characters.
Output: 1 for allies, 0 for enemies.
How it works:
Get the difference between the 2 numbers modulo 9, use a bitmask (390 is binary 110000110) and get a single bit using the [] operator.

Ah nice, I keep forgetting that integers can be indexed. +1

16 bytes : ->x,y{x*y%103%2} Note that 0 and 1 are reversed.

And 15 bytes with x*y%51>9 like everybody else. I think it would be unfair to the upvotes to change it so radically now.

CJam, 8 bytes
{*51%9>}

An unnamed block that expects two character codes on top of the stack and replaces them with 0 (friends) or 1 (foes).
Try it online!
Explanation
Well, we've seen a lot of fun arithmetic solutions now, so I guess it's fine if I present my own one now. The closest to this I've seen so far is Steadybox's C solution. This one was found with the help of a GolfScript brute forcer I wrote some time ago for anarchy golf.
Here is what this one does to the various inputs (ignoring the order, because the initial multiplication is commutative):
xy   x    y    x*y   %51  >9

WU   87   85   7395    0   0
UB   85   66   5610    0   0
BR   66   82   5412    6   0
RG   82   71   5822    8   0
GW   71   87   6177    6   0
WB   87   66   5742   30   1
UR   85   82   6970   34   1
BG   66   71   4686   45   1
RW   82   87   7134   45   1
GU   71   85   6035   17   1

We can see how taking the product of the inputs modulo 51 nicely separates the inputs into large and small results, and we can use any of the values in between to distinguish between the two cases.

C, 33 32 29 24 22 bytes
#define f(k,l)k*l%51<9

Returns 1 if friends, 0 if foes.

Röda, 30 22 21 bytes
Bytes saved thanks to @fergusq by using _ to take the values on the stream as input
{[_ in"WUBRGWGRBUW"]}

Try it online!
The function is run like push "WU" | f after assigning a name to the function
Explanation
{                      /* Declares an anonymous function */
 [                 ]   /* Push */
  _ in                 /* the boolean value of the value on the stream is in */
      "WUBRGWGRBUW"    /* this string */
}

o_O lightning speed

It's possible to save 5 bytes by reading the input values from the stream instead of taking parameters: {[(_.._)in"WUBRGWGRBUW"]}, but then the function must be called like [a, b] | f.

05AB1E, 10 bytes
Returns 0 for friend and 1 for foe.
‘Û‹BWR‘ûIå

Try it online!
or as a Test suite
Explanation
‘Û‹BWR‘     # push the string "RUGBWR"
       û    # palendromize (append the reverse minus the first char)
        Iå  # check if input is in this string

Japt, 6 bytes
Inspired by @Martin Ender's  solution.
Takes an array of two char codes as input.
×%51<9

Try it online! | Test Suite
Returns true for friends, false for foes.
14-byte solution:
Takes two char codes as input
nV a /3%3 f ¦1

Try it online! | Test Suite
Explanation:
nV a /3%3 f ¦1
nV a             // Absolute value of: First input (implicit) - Second input
      /3%3 f     // Divide by 3, mod 3, then floor the result
             ¦1  // Return true if the result does not equals 1, otherwise return false

12-byte solution:
"WUBRGW"ê èU

Try it online! |
Test Suite
Explanation:
"WUBRGW"ê èU
"WUBRGW"ê     // "WUBRGW" mirrored = "WUBRGWGRBUW"
          èU  // Returns the number of times U (input) is found

Returns 1 for friends and 0 for foes.
9-byte solution:
Inspired by @Arnauld's solution.
*V%24%B%2

Test Suite
Returns 1 for friends, 0 for foes.
11-byte solution:
inspired by @Mistah Figgins's solution.
nV %9%5%3¦0

Test Suite

Brain-Flak, 155, 147, 135 bytes
(([(({}[{}]))<>])){({}())<>}(((([])[][][])[]())()()())<>{}<>{({}<><(({}))>)({}[{}]<(())>){((<{}{}>))}{}{{}({}<({}())>)(<()>)}{}<>}<>{}

Try it online!
This is 134 bytes of code plus one byte penalty for the -a flag which enables ASCII input.
This works by finding the absolute difference between the inputs, and checking if they equal 2, 11, 16, or 19. If it does, the input is a friend, and it prints a 1. If it's not, it prints nothing. Since nothing in brain-flak corresponds to an empty stack, which is falsy, no output is a falsy value. (meta)
One thing I particularly like about this answer, is that the "absolute difference" snippet (that is, (([(({}[{}]))<>])){({}())<>}{}{}<>{}) is not stack clean, but it can still be used in this answer since we don't care which stack we end up on before encoding the possible differences.
On a later edit, I took advantage of this even more by abusing the leftovers on the stack that doesn't end up with the absolute difference on it. On the first revision, I popped both of them off to keep it slightly more sane. Not doing this gives two major golfs:

Obviously, it removes the code to pop them: {}{}, but more importantly:
It allows us to compress the 2, 11, 16, 19 sequence from
(((((()()))[][][](){})[][]())[])

to
(((([])[][][])[]())()()())

Fortunately, there is no extra code needed to handle these leftovers later, so they are just left on the alternate stack.

Since brain-flak is notoriously difficult to understand, here is a readable/commented version:
#Push the absolute difference of the two input characters. It is unknown which stack the result will end on
(([(({}[{}]))<>])){({}())<>}

#Push 2, 11, 16, 19, while abusing the values left on the stack from our "Absolute value" calculation
(((([])[][][])[]())()()())

#Pop a zero from the other stack and toggle back
<>{}<>

#While True
{

    #Move top over and duplicate the other top
    ({}<><(({}))>)

    #Equals?
    ({}[{}]<(())>){((<{}{}>))}{}

    #If so:
    {

        #Increment the number under the stack
        {}({}<({}())>)
        #Push a zero
        (<()>)

    }

    #Pop the zero
    {}

    #Go back to the other stack
    <>

#Endwhile
}

#Toggle back
<>

#Pop a zero
{}

There's a push, pop you can remove, and you can push 0 in the if more efficiently to get down to 129: TIO

@Riley Cool, thanks for the tip! I like having a commented version, so I'm going to wait until I can comprehend that version before updating.

It was only two minor changes. Here is the important part. My comments are in all caps, sorry if it looks like I'm yelling.

Vim, 22 21 bytes
CWUBRGWGRBUW<esc>:g/<c-r>"/d<cr>

Input: a single line containing the two characters.
Output: empty buffer if friends, buffer containing WUBRGWGRBUW if enemies.
Explanation
C                                 # [C]hange line (deletes line into " register and enters insert mode)
 WUBRGWGRBUW<esc>                 # insert this text and exit insert mode
                 :g/      /d<cr>  # delete all lines containing...
                    <c-r>"        # ... the previously deleted input

You can do C instead of cw

Jelly, 14 bytes
“WUBRG”wÐ€IAÆP

Returns 1 for enemies and 0 for friends.
Test suite at Try it online!
How?
“WUBRG”wÐ€IAÆP - Main link                                   e.g. WG
“WUBRG”        - ['W','U','B','R','G']
       wÐ€     - first index of sublist mapped over the input     [1,5]
          I    - incremental differences                           -4
           A   - absolute value                                     4
            ÆP - is prime?                                          0

05AB1E, 7 bytes
$Æ105¿Ö

This is a port of my Jelly answer. Takes a list of code points as input. Prints 1 for friends, 0 for foes.
Try it online!
How it works
$        Push 1 and [n, m] (the input).
 Æ       Reduce [n, m] by subtraction, pushing n - m.
  105¿   Take the GCD of n - m and 105.
      Ö  Test if 1 is divisible by the GCD (true iff the GCD is ±1).

CJam, 16 12 11 10 bytes
Golfed 4 bytes by using Mistah Figgins's algorithm
Saved 1 byte thanks to Lynn
l:m9%5%3%!

Outputs 1 for enemy colours, 0 for ally colours.
Try it online! (Or verify all test cases)
Explanation
l           e# Push a line of input as a string
 :m         e# Reduce the string by subtraction (using the ASCII values)
   9%5%3%   e# Mod by 9, then by 5, then by 3. By doing this, enemy
            e#  pairs go to 0, and allies go to 1, 2, -1, or -2.
         !  e# Boolean negation

Don’t try to be too clever! l:m9%5%3%! is a byte shorter.

@Lynn Oh wow, it is. That's kinda boring. Thanks

Cubix, 11 bytes
A Cubix implementation of Arnauld's solution.
U%O@A*'g%2W

Usage
Input the two characters, and it outputs 0 for friends and 1 for foes. Try it here.
Explanation
The code can be expanded like this.
    U %
    O @
A * ' g % 2 W .
. . . . . . . .
    . .
    . .

The characters are executed in this order (excluding control flow):
A*'g%2%O@
A         # Read all input as character codes
 *        # Multiply the last two character codes
    %     # Modulo the result by
  'g      #     103
      %   # And modulo that by
     2    #     2
       O  # Output the result ...
        @ # ... and terminate

Brachylog, 10 bytes
A straightforward solution, no tricks involved.
p~s"WUBRGW

Try it online!
Explanation
p               A permutation of the input
 ~s             is a substring of
   "WUBRGW      this string

Jelly, 6 bytes
ạ:3%3Ḃ

For completeness's sake. Takes two code points as argument. Yields 0 for friends, 1 for foes.
Try it online!
Background
Let n and m be the code points of two input characters. By taking |n - m|, we need to concern ourselves only with all 2-combinations of characters. The following table shows all 2-combinations of characters the the corresponding absolute differences.
WU UB BR RG GW  WB UR BG RW GU
 2 19 16 11 16  21  3  5  5 14

If we divide these integers by 3, we get the following quotients.
WU UB BR RG GW  WB UR BG RW GU
 0  6  5  3  5   7  1  1  1  4

1, 4, and 7 can be mapped to 1 by taking the results modulo 3.
WU UB BR RG GW  WB UR BG RW GU
 0  0  2  0  2   1  1  1  1  1

Now we just have to look at the parity.
How it works
ạ:3%3Ḃ  Main link. Left argument: n (code point). Right argument: m (code point)

ạ       Absolute difference; yield |n - m|.
 :3     Integer division by 3, yielding |n - m| / 3.
   %3   Modulo 3, yielding |n - m| / 3 % 3.
     Ḃ  Parity bit; yield |n - m| / 3 % 3 & 1.

Java (OpenJDK 8), 28 23 bytes
-5 bytes thanks to fergusq
"WUBRGWGRBUW"::contains

Try it online!

Can you do "WUBRGWGRBUW"::contains?

Retina, 18 bytes
O`.
BR|BU|GR|GW|UW

Try it online!
Quite straight-forward: sorts the input and tries to match any of the sorted ally pairs against it. Unfortunately, I don't think that Retina's string-based nature allows for any of the more interesting approaches to be competitive.
As a sneak peek for the next Retina version, I'm planning to add an option which swaps regex and target string (so the current string will be used as the regex and you give it a string to check), in which case this shorter solution will work (or something along those lines):
?`WUBRGWGRBUW

Python 2, 26 bytes
lambda a:a in"GWUBRGRBUWG"

Try it online!

PHP, 31 bytes
echo!strstr(WBGURWRUGBW,$argn);

Run with echo AB | php -nR '<code>, where A and B are the two colors.
strtr returns the string from the position where the input is found;
with WBGURWRUGBW as haystack this returns a truthy string if the colors are foes; empty string if not.
! turns the truthy string to false, resulting in empty output
and the empty string to true, resulting in output 1.

Jelly, 12 bytes
“WUBRGW”ŒBẇ@

Outputs 1 for allies, 0 for enemies.
Try it online!
Explanation
“WUBRGW”ŒBẇ@   Main link

“WUBRGW”       The string "WUBRGW"
        ŒB     Bounce; yields "WUBRGWGRBUW"
          ẇ@   Check if the input exists in that string

Ruby, 28 bytes
Outputs true for friend, false for foe:
p'WUBRGWGRBUW'.include?$**''

The ungolfed version isn't much different:
p 'WUBRGWGRBUW'.include?(ARGV.join(''))

05AB1E, 7 bytes
Adaptation of the mod-trick from Jonathan's Jelly answer
Æ451bsè

Try it online!
or as a Test suite
Explanation
 Æ        # reduced subtraction
  451b    # 451 to binary (111000011)
      sè  # index into this with the result of the reduced subtraction

///, 40 bytes
//i//R///G///W///U///B///i/1/WUBRGWGRBUW

Try it online!
Since /// has no other way of taking input, you need to put your input after the first /. An example of checking WG:
/WG/i//R///G///W///U///B///i/1/WUBRGWGRBUW

Itflabtijtslwi, 52 bytes
GGjGGGGkGG/jk/i//R///G///W///U///B///i/1/WUBRGWGRBUW

Try it online!
Outputs a 1 if they are allies, otherwise outputs nothing.
The funny part is that it is actually a shorter answer than some "real" languages have.
You may be thinking, "You're not allowed to code the input in the program!" But you are allowed to do so if the language has no other way of getting input, as said here: meta.codegolf.stackexchange.com/a/10553/64159.
Thanks to Ørjan Johansen for the help with the Itflabtijtslwi port and making the interpreter. Very much.

Ah, okay. Didn't know about that.

The itflabtijtslwi won't work, first a GG...GG command only reads a single character, secondly it substitutes the other way around. Try something like GGjGGGGkGG/jk/i/.

@ØrjanJohansen I made the edit, is that correct? Also, is there an online interpreter for itflabtijtslwi? I could not find one.

Try it online! Stripped my Perl one into a TIO header/footer. Still large for comments. :(

@ØrjanJohansen Thank you very much. If you don't mind, I'll put that in my answer.

Sure. I just added the TIO hack to the Esolang wiki to make it official :)

GolfScript, 7 bytes
~*51%9>

Takes two code points as input.
Try it online! (Test suite which converts the input format for convenience.)
A GolfScript port of my CJam answer (which technically, is a CJam port of the result of my GolfScript brute forcer... uhhh...).
However, since GolfScript gets modulo with negative inputs right, there's a fun alternative solution at the same byte count which uses 4 for foes instead of 1:
~-)9%4&

Try it online!
xy   x    y    x-y    +1  %9  &4

WU   87   85     2     3   3   0
UB   85   66    19    20   2   0
BR   66   82   -16   -15   3   0
RG   82   71    11    12   3   0
GW   71   87   -16   -15   3   0
WB   87   66    21    22   4   4
UR   85   82     3     4   4   4
BG   66   71    -5    -4   5   4
RW   82   87    -5    -4   5   4
GU   71   85   -14   -13   5   4

Java 7, 38 bytes
int b(int a,int b){return(a-b)%9%5%3;}

Port from @Mistah Figgins' Befunge-98 answer is the shortest in Java 7 from the answers posted so far.
As for the others:
39 bytes: Port from @Arnauld's JavaScript (ES6) answer.
int a(int a,int b){return a*b%24%11%2;}

39 bytes: Port from @MartinEnder's CJam answer
Object e(int a,int b){return a*b%51>9;}

47 bytes: Port from @Steadybox' C answer
Object d(int a,int b){return(a=a*b%18)>7|a==3;}

52 bytes: Port from @Lynn's Python 2 answer
Object c(String s){return"WUBRGWGRBUW".contains(s);}

NOTE: Skipped answers which uses primes / palindromes and alike, because those are nowhere near short in Java. ;)
TODO: Coming up with my own answer.. Although I doubt it's shorter than most of these.
Try all here.

EDIT: Ok, came up with something myself that isn't too bad:
50 bytes:
Object c(int a,int b){return(a=a*b%18)>3&a<7|a<1;}

Explanation:
ab  a   b   a*b     %18

WU  87  85  7395    15
UB  85  66  5610    12
BR  66  82  5412    12
RG  82  71  5822    8
GW  71  87  6177    3
UW  85  87  7395    15
BU  66  85  5610    12
RB  82  66  5412    12
GR  71  82  5822    8
WG  87  71  6177    3

WB  87  66  5742    0
UR  85  82  6970    4
BG  66  71  4686    6
RW  82  87  7134    6
GU  71  85  6035    5
BW  66  87  5742    0
RU  82  85  6970    4
GB  71  66  4686    6
WR  87  82  7134    6
UG  85  71  6035    5

All enemies are either in the range 4-6 (inclusive) or 0.
EDIT2: Hmm.. I just noticed it's very similar to @Steadybox' answer.. :(

Python 2, 56 46 28 Bytes
print input()in"WUBRGWGRBUW"

Takes input as a string and returns True or False if it is in the string b. Try it here! Thanks to @Григорий Перельман  for removing 10 bytes! Thanks @SparklePony for removing another 18 bytes!

AWK, 23 Bytes
{$0="WUBRGWGRBUW"~$1}1

Example usage:
    awk '{$0="WUBRGWGRBUW"~$1}1' <<< UB
This prints 1 if the pair is a friend, 0 otherwise.
I wanted to do something clever, but everything I thought of would be longer.

Brain-Flak, 78 bytes
(([(({}[{}]))]<>)){({}())<>}([]()(([])[]([][][]({}{}({}))))){{}}{}({()<{{}}>})

Try it online!
This improves on DJMcMayhem's answer by streamlining the comparisons.  It also uses the negative absolute value directly instead of using extra instructions to reach the positive absolute value.

Batch, 62 bytes
@set s=WUBRGWGRBUW
@call set t=%%s:%1=%%
@if %s%==%t% echo 1

Outputs 1 for foes, nothing for friends.

PHP, 45 Bytes
I know if I use a mod solution from someone else, that I can do it much shorter.
the absolute difference mod 17 mod 5 is 1 or 2
<?=abs(ord($t=$argv[1])-ord($t[1]))%17%5+1&2;

golfed down by @Titus from 64 Bytes
<?=in_array((abs(ord(($t=$argv[1])[0])-ord($t[1]))%17)%5,[1,2]);

PHP, 72 Bytes
the absolute difference mod 17  foes contains a digit between 3 and 5
<?=preg_match("#^[^3-5]+$#",(abs(ord(($t=$argv[1])[0])-ord($t[1]))%17));

PHP, 88 Bytes
the absolute difference mod 17 friends have a digit sum of 2 or 7
<?=in_array(array_sum(str_split((abs(ord(($t=$argv[1])[0])-ord($t[1]))%17))),[2,7])?1:0;

PHP >= 7.1, 81 Bytes
$p=strpos($s=WUBRG,($i=$argv[1])[0]);echo$i[1]==$s[$p!=4?$p+1:0]|$i[1]==$s[$p-1];

http://sandbox.onlinephpfunctions.com/code/9136a36084ecb5b397466e839210b50a88d8fe98

Oh well ... stolen arithmetics: echo ord($argn)*ord($argn[1])%51<9; is another 9 bytes shorter (35 bytes).

Java 8, 17 16 14 bytes
This is simply a Java lambda version of the same arithmetic solution everyone else is using. Takes two integral/character arguments containing the color codes as ASCII. Returns true if they are friends, false if foes.
Golfed:
a->b->a*b%51<9

Ungolfed:
import java.util.function.*;

public class MagicTheGatheringFriendsOrFoes {

  private static final char[][] FRIENDS = new char[][] { { 'W', 'U' }, { 'U', 'B' }, { 'B', 'R' }, { 'R', 'G' },
      { 'G', 'W' }, { 'U', 'W' }, { 'B', 'U' }, { 'R', 'B' }, { 'G', 'R' }, { 'W', 'G' } };

  private static final char[][] FOES = new char[][] { { 'W', 'B' }, { 'U', 'R' }, { 'B', 'G' }, { 'R', 'W' },
      { 'G', 'U' }, { 'B', 'W' }, { 'R', 'U' }, { 'G', 'B' }, { 'W', 'R' }, { 'U', 'G' } };

  public static void main(String[] args) {
    System.out.println("Friends: expect true");
    for (char[] friends : FRIENDS) {
      boolean result = f().apply(Integer.valueOf(friends[0])).apply(Integer.valueOf(friends[1]));
      System.out.println("(" + friends[0] + "," + friends[1] + ") = " + result);
    }

    System.out.println();
    System.out.println("Foes: expect false");
    for (char[] foes : FOES) {
      boolean result = f().apply(Integer.valueOf(foes[0])).apply(Integer.valueOf(foes[1]));
      System.out.println("(" + foes[0] + "," + foes[1] + ") = " + result);
    }
  }

  private static Function<Integer, IntFunction<Boolean>> f() {
    return a -> b -> a * b % 51 < 9;
  }
}

"This is simply a Java lambda version of the same arithmetic solution everyone else is using." I believe you're only the third person using it. ;)

You can remove the final ; as it's not part of the function itself. Also, you can curry it: a->b->a*b%51<9 for 14 bytes total.

Finally, you counted 1 byte too much: your answer is 16 bytes, but you say it's 17.

@OlivierGrégoire you are correct, the trailing ; should not be counted. As far as currying, I can't quite get that to compile no matter how I set up the second function. What approach should I take here?

interface FunctionA { FunctionB apply(int a); } interface FunctionB { boolean apply(int b); } then you use it like this: FunctionA f = a->b->a*b%51<9;.

@OlivierGrégoire thanks, got it.

S.I.L.O.S, 53 bytes
loadLine
a=get 256
b=get 257
a*b
a%103
a%2
printInt a

Try it online!
Input as a commmand line argument Please do note that this uses the method from the most upvoted answer

Let us continue this discussion in chat.

PowerShell, 42 34 32 bytes
'WUBRGWGRBUW'.indexof($args)-ge0

Try it online!
Input is as a single string (e.g., RG), that is stringified $args and used as the .indexof() parameter for the color string. If the substring is not found, -1 is returned, so testing whether the result is -greater-than-or-equal to 0 suffices for a truthy/falsey output.
Saved two more bytes thanks to Philipp Leiß.

bash, 23 bytes
[[ WUBRGWGRBUW =~ $1 ]]

Exits/returns 0 (success/true) if friends, 1 (failure/false) if enemies.
This works by using the input string (for example, WU) as a regular expression using bash's builtin [[, which tests various things, in this case, the =~ operator of [[ is used to see if the first string WUBRGWGRBUW matches the regex (input string). Since the regex is not anchored by default, so long as the input string occurs anywhere in the "checked" string, [[ returns the status code 0, meaning the test result was true. If the input character pair did not occur anywhere in the string, it returns status code 1, meaning the test result was false. The tested string is a concatenation of all possible adjacent friend characters, so it's matched only by the friend-pair inputs.
Test:
for pair in WU UB BR RG GW UW BU RB GR WG WB UR BG RW GU BW RU GB WR UG
do
  bash -c '[[ WUBRGWGRBUW =~ $1 ]]' - $pair
  echo $pair $?
done

OIL, 77 bytes
Third-worst answer, but hey, it's OIL. Commented for clarity (remove spaces and C++-style comments for execution)
WU //storage, this just nops
UB
BR
RG
GW
UW
BU
RB
GR
WG
5  // read user input into line 10 (overwriting this line)
10
10 // test if what's in line 10 (the user input) &
10
0  // is identical to what's in line 0 (the first string) *
26 // if so, jump to line 26 (marked with %)
17 // else, jump to the next line
8  // increment line 14 (marked with *)
14
10 // test if line 14 is identical to
14
11 // what's in line 11 (a "10")
27 // if so, we checked all strings; so jump to line 27 (marked with $)
24 // else jump to the next line
6  // jump to line 12 (marked with &)
12
4  // print what's in line 4 ("GW" ≙ friend) %
4  // print what's in line 0 ("WU" ≙ foe) $

Prints GW if the colours are allies, WU otherwise (and if any unexpected input occurs).

Brain-Flak, 90 bytes
(<({}[{}])>)([[]()]((([])[][][])[][])){([({}<>)])<>}{}<>({<({}<>({}))>(){[()](<{}>)}{}<>})

Try it online!
This beats the previous Brain-Flak answer by swapping getting the absolute value of the difference with creating negative copies of the differences to check. It also has slightly better number generation and difference checking

Whitespace, 60 bytes
[S S S N
_Push_0][S N
S _Duplicate_0][T   N
T   S _Read_input_as_character][T   T   T   _Retrieve_first_input][S N
S _Duplicate_first_input][S N
S _Duplicate_first_input][T N
T   S _Read_input_as_character][T   T   T   _Retrieve_second_input][T   S S N
_Multiply][S S S T  T   S S T   T   T   N
_Push_103][T    S T T   _Modulo][S S S T    S N
_Push_2][T  S T T   _Modulo][T  N
S T _Print_as_integer]

Letters S (space), T (tab), and N (new-line) added as highlighting only.
[..._some_action] added as explanation only.
Port of @Arnauld's 15-bytes JavaScript answer, so also outputs 0 for friends and 1 for foes.
Try it online (with raw spaces, tabs, and new-lines only).
Explanation in pseudo-code:
Integer a = read STDIN as character
Integer b = read STDIN as character
Integer t = a * b
t = t % 103
t = t % 2
Print t as integer to STDOUT

C#, 37 Bytes
(string s)=>"GWUBRGRBUWG".Contains(s)

JavaScript (ES6), 20 bytes
a=>b=>(a-b)%9%5%3!=0

let F = a=>b=>(a-b)%9%5%3!=0
let ch = [87, 85, 66, 82, 71];

console.log('Friends:');
console.log('WU/UW', F(ch[0])(ch[1]), F(ch[1])(ch[0]));
console.log('UB/BU', F(ch[1])(ch[2]), F(ch[2])(ch[1]));
console.log('BR/RB', F(ch[2])(ch[3]), F(ch[3])(ch[2]));
console.log('RG/GR', F(ch[3])(ch[4]), F(ch[4])(ch[3]));
console.log('GW/WG', F(ch[4])(ch[0]), F(ch[0])(ch[4]));

console.log('Foes:');
console.log('WB/BW', F(ch[0])(ch[2]), F(ch[2])(ch[0]));
console.log('UR/RU', F(ch[1])(ch[3]), F(ch[3])(ch[1]));
console.log('BG/GB', F(ch[2])(ch[4]), F(ch[4])(ch[2]));
console.log('RW/WR', F(ch[3])(ch[0]), F(ch[0])(ch[3]));
console.log('GU/UG', F(ch[4])(ch[1]), F(ch[1])(ch[4]));

Takes input as ascii character codes, passed in as F(a)(b) (one character each). Returns true for friends, false for foes.
Thanks to Mistah Figgins for the modulo idea.

QBIC, 29 bytes
;?instr(@WUBRG`+@W`+_fB|,A)>0

Explanation:
;       Gets the color combination as one strintg, "UG"
?       Print --> will eventually yield -1 for allies and 0 otherwise
instr(  Get the index of one string in antother.
@WUBRG` The string to be searced is all allies, (@...` creates a string called B$)
+@W`      and an extra 'W' that we don't want to flip (prevents 'WW')
+_fB|    and all allies flipped --> WUBRGWGRBUW
,A)    The string to look for: "UG"
>0     If A is found in B+G+fB, this is >0, and PRINT will show -1 (QBasic's TRUE value)
       It prints 0 in all other cases.

This would be two bytes shorter if we could say that any positive value is true, and 0 is false...

Pyth, 16 bytes
gx+J"WUBRGW"_JzZ

Test suite available online.
Explanation
gx+J"WUBRGW"_JzZ
   J"WUBRGW"      store string in variable J
  +         _J    concat J and reversed J
 x            z   get index of input in this string
g              Z  return if index >= 0 (will be -1 if not found)

Perl 5, 18 bytes
$_=WUBRGWGRBUW=~$_

Try it online!
Takes input as a two letter string, upper case.  Outputs 1 (true) for allies, nothing (false) for enemies.

Thunno 2, 7 bytes
×.6/4Æ&

Try it online!
Link is to verify all test cases. Port of Arnauld's JS answer.
Explanation
×.6/4Æ&  # Implicit input as charcodes
×        # Multiply the two charcodes together
 .6/     # Divide this result by 0.6
    4Æ&  # Bitwise AND with 4
         # Implicit output

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Pie of pi pies (Pie day 2017)
In honor of national pi day, create a program that, when given an integer, n, as input, will create a circular "pie" constructed of these smaller pies:

Your program should output the image in a closed polygonal shape, and the number of outputted images should be equal to the value of the nth digit of pi.
Below are some possible answers. Please consider the *s as copies of the given image. You can treat the below as test cases.
N = 1 (first digit of pi: 3)
  *
*   *

n= 4 (4th digit of pi: 1)
*

n=33 (33rd digit of pi: 0)

This is code golf, so the shortest solution (in bytes) wins!
Digits of pi

@SparklePony I have made the clarification, would that suffice?

I think so. The way I understand it, you need to put x pictures of the pie in a closed polygon pattern, where x is the value of the nth digit of pi. So, if n was 7, my output would be: * * * * * * *, but arranged circularly and be the image.

@sparklepony correct, and the ascii diagrams are meant to be models for test cases, and defining the ambiguous case of 0.

Despite the edit, I think this is still far from well-specified.

Since you speak of a circular pie made out of images in a closed polygonal shape, I assume they are equilateral? You also state "should output the image in a closed polygonal shape" with singular image, instead of plural images. Perhaps it's also better to add test cases for all 10 possible outputs (0 through 9) with the actual images, instead of ASCII art, since that's what we want to achieve. Also, do we have to use that image as is, or can we make it smaller (outside the program/function) to have a more compact output? And should we get the image from disk, or could we use a link?

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Sort useless characters
This challenge is inspired by this very nice answer by TidB.

In TidB's answer, every eight character is in the correct order: gnilwoB edoC (Code Bowling backwards). The other strings however are were in a strange, random order.
Your challenge is to fix this.
Take a (non-empty) string and a positive integer n as input. The string will contain ASCII characters in the range: 32-126 (space to tilde).
You must sort the string in ascending order (seen from the left, based on the ASCII-code value), but skip every nth character, starting from the end of the string. As an example, let's take the string abcdABC123 as input, and n=4, then we'll get:
abcdABC123   <- Input string. (n=4)
_b___B___3   <- These will not be sorted (every 4th starting from the end)
1_2AC_acd_   <- The remaining characters, sorted
1b2ACBacd3   <- The final string (the output)

Another example:
9876543210   <- Input string (n=2)
_8_6_4_2_0   <- These will not be sorted
1_3_5_7_9_   <- The remaining characters, sorted
1836547290   <- The final string (the output)

The input string can be taken on an optional format (string, list of characters, list of single character strings ...). The input integer can also be taken on an optional format.
Test cases:
The format will be n=__, followed by the input string on the next line. The output is on the line below.
n=1   (All elements will stay in place)
nafgaksa1252#"%#
nafgaksa1252#"%#

n=214  (The last character will stay in place. All other are sorted.
&/lpfAVD
&/AVflpD

n=8
g7L9T E^n I{><#ki XSj!uhl y= N+|wA}Y~Gm&o?'cZPD2Ba,RFJs% V5U.W;1e  0_zM/d$bH`@vKoQ 43Oq*C
g       n !#$%&'i*+,./01l234579;w<=>?@ADoEFGHIJKBLMNOPQR STUVWXYeZ^_`abcdhjkmqsuovyz{|}~C

MATL, 15 14 bytes
ttfiX\qgP)S5M(

Inputs are a string enclosed in single quotes and a number. Single-quote symbols in the string should be escaped by duplicating (as in MATLAB and Octave).
Try it online! Or verify all test cases.
Explanation
Consider inputs 'abcdABC123' and 4.
tt     % Implicitly input string. Duplicate twice
       % STACK: 'abcdABC123', 'abcdABC123', 'abcdABC123'
f      % Find: indices of nonzero elements: gives [1 2 ... n] where n is input length
       % STACK: 'abcdABC123', 'abcdABC123', [1 2 3 4 5 6 7 8 9 10]
i      % Input n
       % STACK: 'abcdABC123', 'abcdABC123', [1 2 3 4 5 6 7 8 9 10], 4
X\     % 1-based modulo
       % STACK: 'abcdABC123', 'abcdABC123', [1 2 3 4 1 2 3 4 1 2 3 4]
qg     % Subtract 1, convert to logical: gives true (1) for 1, false (0) otherwise
       % STACK: 'abcdABC123', 'abcdABC123', [0 1 1 1 0 1 1 1 0 1]
P      % Flip
       % STACK: 'abcdABC123', 'abcdABC123', [1 0 1 1 1 0 1 1 1 0]
)      % Use as logical index into the string
       % STACK: 'abcdABC123', 'acdAC12'
S      % Sort
       % STACK: 'abcdABC123', '12ACacd'
5M     % Push logical index again
       % STACK: 'abcdABC123', '12ACacd', [1 0 1 1 1 0 1 1 1 0]
(      % Write into original string as specified by the index. Implicitly display
       % STACK: 1b2ACBacd3

1-based modulo means that mod([1 2 3 4 5], 3) gives [1 2 3 1 2] instead of the usual (0-based) [1 2 0 1 2]. This is needed here to handle the case n=1 adequately.

I wish 05AB1E had that last command...

Octave, 65 54 bytes
function s=f(s,n)
l=~~s;l(end:-n:1)=0;s(l)=sort(s(l));

Try it online!
Uses logical indexing to make an array of 'fixed' and 'sorted' characters. Explanation:
function s=f(s,n) % Create a function, taking a string `s` and the number `n`; the output is also named `s`.
l=~~s;             % Create logical array with the same size of the input string
                  %    [equivalent to much more verbose true(size(s))].
l(end:-n:1)=0;    % Set the 'fixed' character positions. MATLAB/Octave automatically produces
                  %    the correct result even if n is larger than the string length.
s(l)=sort(s(l)) % Select the elements from `s` where `l` is true. Sort, and store in the corresponding positions in `s`.

The way I created l requires that s is nonzero, which I think is a reasonable requirement, as many languages use \0 as an end-of-string delimiter.

You can save some bytes if you bypass l and use a vector of index numbers directly

@Leo http://meta.codegolf.stackexchange.com/questions/11710/should-we-stop-being-so-generous

@Leo, isn't your suggestion 8 bytes longer?

@StewieGriffin whoops, I didn't see the updated solution

PHP, 101 bytes
negative string indexes (PHP 7.1) save 21 bytes - and possibly the day:
for([,$s,$n]=$argv;a&$c=$s[$i-=1];)$i%$n+1?$a[]=$c:0;for(sort($a);++$i;)echo$i%$n+1?$a[+$k++]:$s[$i];

Run with php -nr '<code>' '<string>' <N>.
breakdown
for([,$s,$n]=$argv;     # import command line arguments to $s and $n
    a&$c=$s[$i-=1];)    # loop backward through string
    $i%$n+1?$a[]=$c:0;      # if index is not n-th, copy character to array
for(sort($a);           # sort array
    ++$i;)              # loop forward through string:
    echo$i%$n+1             # if index is not n-th
        ?$a[+$k++]              # print character from array
        :$s[$i]                 # else print character from string
    ;

why $i-=1 and not $i-- ?

@JörgHülsermann Because $i-- doesn´t work if $i is NULL.

@JörgHülsermann ... and --$i, which I would need does also not. ;)

I have never tried it before. Thank You for your answer

Python 2, 191 bytes
Yeah, I'm sure this is a terrible solution.
n,s=input()
s=s[::-1]
R=range(len(s)/n+1)
J=''.join
k=s[::n]
t=J(sorted(J(s[i*n+1:i*n+n]for i in R)))
n-=1
print J(j[::-1]for i in zip(k,[t[::-1][i*n:i*n+n][::-1]for i in R])for j in i)[::-1]

Try it online
I'm not going to bother explaining it. It was alright until I realized that it needs to be indexed from the end. Now it's a monster. At this point, I'm just glad it works.

Upvoted because of the "explanation". :P

JavaScript (ES6), 100 93 bytes
Takes input in currying syntax (s)(n).
s=>n=>s.replace(/./g,(c,i)=>(F=_=>(s.length-++i)%n)()?[...s].filter(F,i=0).sort()[j++]:c,j=0)

Formatted and commented
s => n => s.replace(        // given a string s and an integer n
  /./g,                     // for each character c of s
  (c, i) => (               // at position i:
    F = _ =>                //   F = function that tests whether the
      (s.length - ++i) % n  //       character at position i is non-static
  )()                       //   call F() on the current position
  ?                         //   if the current character is non-static:
    [...s].filter(F, i = 0) //     get the list of non-static characters
      F, i = 0              //     by filtering all characters in s with F()
    )                       //
    .sort()[j++]            //     sort them and pick the next occurrence
  :                         //   else:
    c,                      //     let c unchanged
  j = 0                     //   initialize j = non-static character pointer
)                           //

Test cases

let f =

s=>n=>s.replace(/./g,(c,i)=>(F=_=>(s.length-++i)%n)()?[...s].filter(F,i=0).sort()[j++]:c,j=0)

console.log(f("abcdABC123")(4))
console.log(f('nafgaksa1252#"%#')(1))
console.log(f('&/lpfAVD')(214))
console.log(f("g7L9T E^n I{><#ki XSj!uhl y= N+|wA}Y~Gm&o?'cZPD2Ba,RFJs% V5U.W;1e  0_zM/d$bH`@vKoQ 43Oq*C")(8))

Perl 5 -lF, 78+3 = 81 bytes
$i=<>;map{(@F-++$c)%$i&&((push@b,$_),$_='')}@F;say map/./?$_:(sort@b)[$g++],@F

Try it online!

Nice answer! I think this is a slightly different approach, but I can't be sure so I'll share here as a comment. I think that even with old scoring it's -1: Try it online!

Jelly, 14  13 bytes
FṢṁ
ṚsṚµḢ€ż@Ç

Full program that prints the string to STD out*.
Try it online!
How?
ṚsṚµḢ€ż@Ç - Main link: string s, non-negative number n
Ṛ         - reverse s
 s        - split into chunks of size n
  Ṛ       - reverse the resulting list
   µ      - monadic chain separation (call that list x)
    Ḣ€    - head €ach - yield a list of the first entries of each of x and modify x
        Ç - call the last link (1) as a monad - get the sorted and re-split list
      ż@  - zip together (with reversed @rguments)

FṢṁ - link 1, sort and reshape like self: list of lists
F   - flatten into a single list
 Ṣ  - sort
  ṁ - mould the result like the input

I can't help but think there is a way to use the fact that Ḣ modifies its input
* for a function one would want to flatten the output into a single list with F.
For example an input of "abcdABC123", 4 yields:
[[['1'],['b']],[['2','A','C'],['B']],[['a','c',',d'],['3']]]
rather than:
['1','b','2','A','C','B','a','c',',d','3']

JavaScript (Node.js), 100 bytes
n=>g=x=>x.some((c,i)=>(i-(L=x.length-1))%n&&x.some((d,j)=>(j-L)%n&&i<j&c>d&&[x[i]=d,x[j]=c]))?g(x):x

Attempt This Online!
Use no sort

Perl 5, 94 bytes
88 bytes of code + -F -pl flags.
$_=join"",(map{(--$i%$n?"":$F[$#F-$i--]),$_}sort grep$i++%$n,reverse@F),chop if($n=<>)>1

Try it online!
It's quite too long in my opinion, but already not that ugly... I'm still trying to golf it further anyway.

Python + NumPy, 115 114 bytes
from numpy import *
def f(x,n):l=len(x);x=array(x);m=[1<2]*l;m[-1::-n]=[1>2]*len(m[0::n]);x[m]=sort(x[m]);return x

Takes a regular Python list as input (wasn't sure whether taking an array would be considered kosher); returns a NumPy array containing the result.
Works by masking out the relevant indices and sorting the rest.

Python 2, 119 113 bytes
n,l=input()
i=range(len(l))
print"".join(sorted(l[~a]for a in i if a%n)[-a+a/n]if a%n else l[~a]for a in i)[::-1]

Builds a list of all characters to be sorted, sorts them and merges them for printing, while avoiding some of the reversing via negative indexing.

print"".join(sorted(l[~a]for a in i if a%n)[-a+a/n]if a%n else l[~a]for a in i)[::-1] saves 5 bytes

@TidB Thanks, almost eliminated the scrollbar! (Apparantly there was a trailing newline involved in my previous count, therefore it seems to be 113 now instead of 114.)

Burlesque, 36 bytes
pe<-jJ-.hdcoJ)-]j)[-++<>#acoz[\[\[<-

Try it online!
Takes input as N "String"
pe       # Parse and push
<-       # Reverse the string
j        # Put N at the top of the stack
J-.hd    # Store N-1 for later
co       # Split string into chunks of N
J)-]     # Duplicate and take the heads
j)[-     # Take the tails of the other duplicate
++       # Reduce all the "useless" chars to string
<>       # Reverse sort
#aco     # Split into chunks of N-1
z[       # Zip the two lists
\[\[     # Flatten to string
<-       # Reverse the string

Perl 6, 53 bytes
{(my@a=$^a.comb)[grep (@a-*-1)%$^n,^@a].=sort;[~] @a}

Try it online!
It feels like there should be a shorter way of doing this

05AB1E, 14 bytes
DāR<IÖ≠©Ï{®ƶ<ǝ

I/O of the string as a list of characters.
Try it online or verify all test cases (feel free to remove the S and J in the test suite to see the actual I/O with character lists).
And I agree with @mbomb007's comment, although it's still pretty short this way. :)
Explanation:
                #  Example inputs: s=["a","b","c","d","A","B","C","1","2","3"] and n=4
D               # Duplicate the (implicit) character-list input
                #  STACK: [["a","b","c","d","A","B","C","1","2","3"],
                #          ["a","b","c","d","A","B","C","1","2","3"]]
 ā              # Push a list in the range [1,list-length] (without popping the list)
                #  STACK: [s, s, [1,2,3,4,5,6,7,8,9,10]]
  R             # Reverse it to range [length,1]
                #  STACK: [s, s, [10,9,8,7,6,5,4,3,2,1]]
   <            # Decrease each by 1 to range (length,0]
                #  STACK: [s, s, [9,8,7,6,5,4,3,2,1,0]]
    IÖ          # Check for each if it's divisible by the integer-input
                #  STACK: [s, s, [0,1,0,0,0,1,0,0,0,1]]
      ≠         # And invert those truthy/falsey values
                #  STACK: [s, s, [1,0,1,1,1,0,1,1,1,0]]
       ©        # Store this list of truthy/falsey values in variable `®`
        Ï       # Only keep the characters in the list at the truthy indices
                #  STACK: [s, ["a","c","d","A","C","1","2"]]
         {      # Sort those
                #  STACK: [s, ["1","2","A","C","a","c","d"]]
          ®     # Push the truthy/falsey list again from variable `®`
                #  STACK: [s, ["1","2","A","C","a","c","d"], [1,0,1,1,1,0,1,1,1,0]]
           ƶ    # Multiply each by their 1-based index
                #  STACK: [s, ["1","2","A","C","a","c","d"], [1,0,3,4,5,0,7,8,9,0]]
            <   # Decrease everything by 1 to make it 0-based indexing
                #  STACK: [s, ["1","2","A","C","a","c","d"], [0,-1,2,3,4,-1,6,7,8,-1]]
             ǝ  # Insert the sorted characters at those indices in the list
                # (NOTE: Unlike almost all other 05AB1E builtins that use indices, this
                # insert builtin ignores negative and too large indices instead of using
                # modular indexing, so the -1 are conveniently ignored here.)
                #  STACK: [["1","b","A","C","a","B","d","1","2","3"]]
                # (after which this list is output implicitly as result)

Uiua, 16 bytes
⍜▽(⊏⍏.)¬⇌=0◿:⇡⧻,

Try it!
⍜▽(⊏⍏.)¬⇌=0◿:⇡⧻,
             ⇡⧻,  # range of length
           ◿:     # modulo input
         =0       # where is it zero?
        ⇌         # reverse
       ¬          # not
⍜▽(⊏⍏.)           # under-keep-sort (sort input where mask is 1)

J, 28 bytes
]/:~@#~`(I.@])`[}0<(|i.@-@#)

Try it online!

Vyxal, 11 bytes
ẏṘ~ḞFṘ⁽s?∇¢

Try it Online!
Outputs as a list of characters
Explained
ẏṘ~ḞFṘ⁽s?∇¢
  ~Ḟ         # Every nth item of
ẏṘ           # The range [len(string), 0]
  ~          # without popping anything
    F        # Remove each item in that "every nth item" list from the range
     Ṙ       # Reverse that so that the indices are in ascending order
          ¢  # Apply
      ⁽s     # A function that sorts its argument
         ∇   # to the items at indices in
        ?    # the string
          ¢  # and insert the items in the result back at those indices

Created with the help of Luminespire.

Ruby, 64 bytes
Uses regex to grab all irrelevant characters, both for replacement and for sorting.
->i,s,j=-1{s.gsub(r=/.(?!(?=.{#{i}})*$)/){s.scan(r).sort[j+=1]}}

Try it online

Python 3.8 (pre-release), 111 109 bytes
lambda n,s:(l:=len(s),r:=sorted(s[~i]for i in range(l)if i%n),[r.insert(i,s[i])for i in range(~-l%n,l,n)])[1]

Try it online!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Number Chaining Predicate

Problem:
Your task is to decide if in a sequence of numbers, every number contains at least one of the digits of the number that preceded it.
For example, the following should return truthy:
[1, 12, 203, 0, 30]
             ^   ^ Contains a 0
        ^ Contains a 2
    ^ Contains a 1

The following should return falsey:
[1, 32, 23, 34]
    ^ Doesn't contain a 1, therefore false

Your submission can be a function or full program.
Input:
Input can be any reasonable type of sequence. An array of numbers, an array of strings, a delimited string of numbers, etc.
Order matters however, so whatever structure you choose to accept as input obviously must have a definite ordering.
Input can be taken via the stdin or as an argument.
You can assume:

all numbers will be non-negative integers

input will always contain at least 2 numbers

input numbers will not start with a 0

Output:
Output will be a truthy or falsey value (as defined by your language), representing whether or not the above specification is met.
Truthy/falsey values don't need to be consistent between tests.
It can either be output to the stdout or returned.
Test Cases:
True cases:
[1, 1, 1, 11, 111, 11, 1]
[12, 23, 34, 45, 56]
[65, 54, 43, 32, 21]
[123, 29, 9, 59, 55, 52, 2017, 2]
[1234567890, 19, 95, 5012, 23]

False cases:
[1, 2, 3, 4, 5, 1, 11] (2 doesn't contain a 1)
[12, 23, 33, 45] (45 doesn't contain a 3)
[98, 87, 76, 11, 12, 23] (11 doesn't contain a 7 or 6)

This is code-golf, so the least number of bytes wins.

Jelly, 5 4 bytes
f2\Ạ

Input is an array of strings.
Try it online!
How it works
f2\Ạ  Main link. Argument: A (array of strings)

 2\   Pairwise reduce by:
f       Filter, yielding all chars in the left string that appear in the right one.
   Ạ  All; yield 1 if all strings are non-empty, 0 if not.

Python 2, 48 bytes
lambda x:reduce(lambda a,b:set(a)&set(b)and b,x)

Try it online!
Print a empty set for False and the last element for True

Retina, 25 20 bytes
(.).*¶(?=.*\1)

^.+$

Try it online!
Whenever we find a digit that also occurs in the next number, we remove the separator between those numbers (along with the digits in the former number, starting from the shared one, but that's irrelevant). The input is valid, if all separators have been remove in the process, which we check by making sure that the string can be matched as a single line.

Brachylog, 9 bytes
{⊇ᵐ=∧?t}ˡ

Try it online!
Note that this not only works with a list of integers, but also with a list of strings or a list of lists.
Explanation
{      }ˡ       Left fold on the input:
 ⊇ᵐ=              It is possible to find a number which is a subset of both input numbers
    ∧             (and)
     ?t           The output is the second number (to continue the fold)

That's cool. Seems... declarative? Reads like you're just telling the language the specification.

@Carcigenicate Brachylog is indeed declarative, it is based on the declarative logic programming language Prolog.

Prologs actually on my (increasingly) long list of languages to learn when I attain unlimited free time. There's too many cool languages!

JavaScript (ES6), 47 44* 43 bytes
Saved a byte thanks to @Neil
x=>x.every(y=>y.match(`[${p}]`,p=y),p=1/19)

Takes input as a list of strings.
Test snippet

let f =
x=>x.every(y=>y.match(`[${p}]`,p=y),p=1/19)

let g = x => console.log("f([%s]): %s", x.join(", "), f(x.map(String)))

g([1, 1, 1, 11, 111, 11, 1])
g([12, 23, 34, 45, 56])
g([65, 54, 43, 32, 21])
g([123, 29, 9, 59, 55, 52, 2017, 2])
g([123456789, 19, 95, 5012, 23])

g([1, 2, 3, 4, 5, 1, 11])
g([12, 23, 33, 45])
g([98, 87, 76, 11, 12, 23])

*(crossed out 44 is still regular 44)

Does \[${p}]`` not work?

@Neil Not for the first item of each array.

Ah, I see you found a workaround. I had got as far as a=>a.reduce((l,r)=>\${l}`.match(`[${r}]`)&&r)` (which also works for numeric input).

Perhaps you can remove the p&& if you set p=1/19?

@Neil I, uh... well... That's genius, thanks :-)

The 1/19 trick is really cool. However, a simpler '^x' would work just as well (same size, though).

05AB1E, 10 bytes
ü‚vy`Så1åP

Try it online!
or as a Test suite
Explanation
ü‚          # map pairing over each pair in input
  v         # for each pair
   y`       # push as 2 separate elements on stack
     Så     # check each digit in 2nd number for membership in first
       1å   # check if any 1 exists in the resulting list
         P  # product of stack

€Sü.å - I wish this worked like I thought it would.

@carusocomputing: Yeah that would have been great. Or just ü.å or €Süå.

Why doesn't pairwise work with dot commands again?

@carusocomputing: It's only implemented to take the next byte as command. It doesn't take the dot into account.

CJam, 18 15 14 bytes
Saved 4 bytes thanks to Martin Ender
l~Afb_1>.&:,:*

Try it online!
Explanation
l~              e# Read and eval the input
  Afb           e# Convert each number to a list of digits
     _          e# Duplicate the array
      1>        e# Slice it after the first element
        .&      e# Vectorized set intersection; take the set intersection of corresponding
                e#  elements of the two arrays
          :,    e# Get the length of each intersection
            :*  e# Take the product of the whole array.
                e#  Will be 0 if any intersection was empty.

Haskell, 51 48 35 Bytes
-3 bytes thanks to @NickHansen! I really need to get better with those monad operators
-4 and -9 bytes thanks to @Laikoni and @nimi respectively!
and.(zipWith(any.flip elem)=<<tail)

This version takes the input as an array of strings, eliminating the need for show, but as far as I can see it works in largely the same way as the older version:
all(\(x,y)->any(`elem`x)y).(zip=<<tail).map show

(I'm fairly certain I'm allowed to submit an anonymous function like this, but I'll fix it if necessary)
First the numbers are converted to strings. Then the monad magic zip=<<tail creates a function that zips the list with itself which pairs each entry with its neighbor(s). Then all maps a lambda to each pair that checks whether one string contains any chars from the other and finally checks that they all come out True.
Old version that works basically the same way:
f a=and$zipWith(\b->any(`elem`show b).show)a$tail a

I was able to shave a byte by using zip and some (->) monad trickery: f(x,y)=any('elem'x)y;g=all f.(zip=<<tail).map show . edit: elem should [hopefully obviously] be in backticks but that isn't possible with the comment formatter.

44 bytes: and.(zipWith(any.flip elem)=<<tail).map show

It's allowed to take the input as a list of strings, e.g. ["1234567890", "19", "95", "5012", "23"], so you can drop the .map show.

Ruby, 49 48 bytes
->x{x.each_cons(2){|z|x&&=z*' '=~/(.).* .*\1/};x}

Output is nil for false and a "random" integer for true.

Mathematica 62 47 35 bytes
With 12 bytes saved thanks to MartinE.
FreeQ[#⋂#2&@@@Partition[#,2,1],{}]&

FreeQ[#⋂#2&@@@Partition[#,2,1],{}]&[{{1},{1,2},{2,0,3},{0},{3,1}}]

False

FreeQ[#⋂#2&@@@Partition[#,2,1],{}]&[{{1},{1,2},{2,0,3},{0},{3,0}}]

True

Java 8, 94 90 87 bytes
Input is an array of strings representing the numbers. Starting with the second string, it performs a regular expression comparison against each previous string to see if it contains any of its characters: .*[previous string].*.
Golfed:
a->{int r=1,i=0;while(++i<a.length)r*=a[i].matches(".*["+a[i-1]+"].*")?1:0;return r>0;}

Ungolfed:
public class NumberChainingPredicate {

  public static void main(String[] args) {
    System.out.println("Expect true:");
    for (String[] input : new String[][] { { "1", "1", "1", "11", "111", "11", "1" }, { "12", "23", "34", "45", "56" },
        { "65", "54", "43", "32", "21" }, { "123", "29", "9", "59", "55", "52", "2017", "2" },
        { "1234567890", "19", "95", "5012", "23" } }) {
      System.out.println(java.util.Arrays.toString(input) + " = " + exec(f(), input));
    }

    System.out.println();
    System.out.println("Expect false:");
    for (String[] input : new String[][] { { "1", "2", "3", "4", "5", "1", "11" }, { "12", "23", "33", "45" },
        { "98", "87", "76", "11", "12", "23" } }) {
      System.out.println(java.util.Arrays.toString(input) + " = " + exec(f(), input));
    }
  }

  private static java.util.function.Function<String[], Boolean> f() {
    return a -> {
      int r = 1, i = 0;
      while (++i < a.length) {
        r *= a[i].matches(".*[" + a[i - 1] + "].*") ? 1 : 0;
      }
      return r > 0;
    };
  }

  private static boolean exec(java.util.function.Function<String[], Boolean> function, String[] input) {
    return function.apply(input);
  }

}

Nice! A lot shorter than I was about to post.. Anyway, you can golf some more: a->{for(int i=1;i<a.length;)if(!a[i].matches(".*["+a[i++-1]+"].*"))return 0>1;return 1>0;} (90 bytes)

I also golfed it to 90, but in a different way: a->{int r=1;for(int i=0;++i<a.length;)r*=a[i].matches(".*["+a[i-1]+"].*")?1:0;return r>0;}

Nevermind, got it to 87: a->{int r=1,i=0;for(;++i<a.length;)r*=a[i].matches(".*["+a[i-1]+"].*")?1:0;return r>0;}

Thanks to both of you. I think the only way to improve this by a meaningful amount now is to look at the regex.

Jelly, 6 bytes
Dµf"ḊẠ

Try it online!
Explanation
Dµf"ḊẠ
Dµ        Treat the first (i.e. only) input as a list of decimal digits
   "      For each pair of corresponding elements in {the input digits} and
    Ḋ     {the input digits} with the first element removed
  f       take all elements common to both sides
     Ạ    then return true if the result has no empty lists, false otherwise

It's most obvious to try to use 2/ here, but that runs a unary function on all slices of size 2. "Ḋ effectively runs a binary function on all pairs of adjacent elements, which means we can use f directly (rather than needing to convert it to a unary function as f/). This does end up leaving the last element of the input in place, but luckily not even an input of 0 becomes an empty list when converted to decimal, so it has no effect on the Ạ.

Python 3, 48 bytes
f=lambda x:x==x[:1]or{*x[0]}&{*x[1]}and f(x[1:])

Try it online!

Jelly, 8 bytes
Dœ&L¥2\Ạ

Try it online!
How?
Dœ&L¥2\Ạ - Main link: the list of integers            e.g. [3, 13, 351, 73, 82]
D        - convert all the integers to decimal lists       [[3],[1,3],[3,5,1],[7,3],[8,2]]
     2\  - 2-slice cumulative reduce with:
    ¥    -     last two links as a dyad:
 œ&      -         multiset intersection                   [[3],[1,3],[3],[]]
         -         length                                  [1,2,1,0]
       Ạ - all truthy?                                     0

05AB1E, 5 bytes
Code:
üÃõå_

Uses the CP-1252 encoding. Try it online! or Verify all test cases!.
Explanation:
üÃ         # Intersection on each pair
  õå       # Check if the empty string exists
    _      # Boolean negate

Oh man it DOES work! RüÃõå_ was what I came up with on my own. I'm honored to have been so close to your best answer, deleting mine. Why do you not need the R though?

@carusocomputing Hmmm, what is the R for then? :p

PowerShell, 87 bytes
param($n)(1..($a=$n.length-1)|?{[char[]]$n[($i=$_)-1]|?{$n[$i]-like"*$_*"}}).count-eq$a

Try it online!
Not the shortest by any measure, but a slightly different approach than others are using, and shows off the nifty |?{} functionality.
This takes the input as an array of strings into $n, then loops from 1 up to the length-1. We use Where-Object (the |?{...}) to pull out those indices that are truthy for a particular condition. You can think of this like a combination for loop with an if clause.
The clause here is [char[]]$n[($i=$_)-1]|?{$n[$i]-like"*$_*"}. That is, we're taking the current index $_, setting it to $i, and subtracting 1, and using that to index into $n (i.e., so we get the previous element in our input array). That is then cast as a char-array and sent through another Where-Object procedure.
The inner clause $n[$i]-like"*$_*" specifies that the string at the current index $i is -like the current character $_ from the previous index. This will therefore output any characters that are in common between the two array elements. Thus, the outer clause will only be truthy if there is a character in common (since an empty array is falsey in PowerShell), and so the index will only be selected if there are characters in common.
Then, we gather up all of the indices that matched the criteria, and verify that the .count thereof is -equal to the length of the input array. That Boolean result is left on the pipeline, and output is implicit.

Perl 5, 31 bytes
A port of Martin Ender's beautiful answer.
30 bytes of code + -p flag.
s/(\S)\S* (?=\S*\1)//g;$_=!/ /

Try it online!

PHP, 65 68
for(;null!==$a=$argv[++$i+1];)$r+=$a==strtr($a,$argv[$i],_);echo!$r;

iterate over all numbers and remove all digits that appeared in the previous. Count how often it equals the number itself (no digit removed). If at least one equaled we didn't have a match in one of the pairs.

Fixed a mistake using trim insted of strtr. Thanks to @JörgHülsermann

A big Sorry. for the given testcases your solution works. ["filename",1,11,414] works not.

@JörgHülsermann sure trim only works for the leading and trailing chars. Fixed it.

For PHP<7.1, you can use a& instead of null!== (-5 bytes).

... but this will only work for the first digit in $argv[$i], because "If from and to have different lengths, the extra characters in the longer of the two are ignored." (from the manual)

APL (Dyalog APL), 9 bytes
∧/×≢¨2∩/⎕

Try it online!
∧/ are all ones in the list of
× the signs
≢ of the tally of
¨ each of
2∩/ the pair-wise intersections of
⎕ the input?

I'm not sure what "the signs" means, but you can assume all numbers will be positive.

@Carcigenicate they can be zero too.

Yes, sorry. "Non-negative".

PHP, 75 bytes
for($b=3**39;--$argc;)preg_replace("#[$b]#","",$b=$argv[$argc])<$b?:die(1);

takes numbers from command line arguments; exits with 1 for falsy, with 0 for truthy.
Run with -r or test it online.

start with $b = a number containing all digits
loop down through the arguments

remove all digits of $b from the argument
copy argument to $b
if no digit was removed, exit with 1

implicit: exit with 0

PHP, 77 Bytes
for($i=$t=1;++$i<$argc;)$t*=preg_match("#[{$argv[$i-1]}]#",$argv[$i]);echo$t;

Alternative: foreach($argv as$k=>$v)$t=$k--?$t*preg_match("#[{$argv[$k]}]#",$v)):1;echo$t;, 77 bytes (untested).

@IsmaelMiguel Heavy alternative First you must change $k-- to --$k and drop one ) after that your approach should work and you must add a @ for the warning

Oh, yes, didn't notice the useless parenthesys that causss syntax errors. And I disagree about the $k--. I specifically used it so that $k is still 0 on the first run. And warnings are ignorable. That means the code now is 76 bytes, but still untested.

After the edit, I can confirm that foreach($argv as$k=>$v)$t=$k--?$t*preg_match("#[{$argv[$k]}]#",$v):1;echo$t; is working as it should. Testing with $argv = array(1, 12, 123, 3, 34, 45, 5, 5); displays  1 and testing with $argv = array(1, 12, 123, 3, 34, 45, 5, 6); displays 0, as expected.

@IsmaelMiguel You forget that the first parameter in the is the filename.

Oh, right... I forgot about it. Fixing the code would make it look like foreach($argv as$k=>$v)$t=$k-->1?$t*preg_match("#[{$argv[$k]}]#",$v):1;echo$t;, increasing the size by 1 byte :/

I've fixed it, and kept the bytecount to 77: foreach($argv as$k=>$v)$t=$k--<2||$t*preg_match("#[{$argv[$k]}]#",$v);echo$t;

@IsmaelMiguel Or you use the --$k if k=0 it it not interesting cause k=1 set the true checker to 1

I don't understand :/

@IsmaelMiguel Your first approach. --$k instead of $k-- . if $k is 0 it is 0. But if $k is 1 the true variable is set to 1 so the first item in the array is not interesting . See my first comment

MATL, 14 bytes
1&)"V@VX&nv@]x

Try it online!
Thanks @LuisMendo for saving a byte. Explanation:
1&)            % 'Pop' the first item from the input and push it on the stack.
   "       ]   % Main 'for' loop, to loop over the rest of the input.
    V            % Stringify previous (or first) iten from the input.
     @V          % Push current number, convert to string
       X&        % Intersect with stringified number already on the stack.
         nv      % Count the size of the intersection, and add it to the existing list of sizes.
           @     % Push the current number again for the intersection in the next loop.
             x % Remove the number pushed by the last loop.
               % Else the program would end with the result on the second instead of the first position in the stack

You can save a byte replacing 1)VG by 1&) (and this avoids repeating the first number)

@LuisMendo Of course! I vaguely remembered that MATL had this functionality, but searching for "pop" (like in a queue or stack) in the spec didn't yield any results, so I thought I was mistaken.

Yes, actually it's a particular case of reference indexing. With two outputs, a reference indexing operation like ) gives the selected values as first output, and then the remaining values as second output

@LuisMendo Clever. They should hire you MATL guys to improve MATLAB...

Haha. I do miss some of these features in MATLAB sometimes

Röda, 45 35 bytes
{[_=~`(\S*(\S)\S* (?=\S*\2))+\S+`]}

Try it online!
This is similar to the Perl 5 solution, which is a port of the Retina solution by Martin Ender. -10 bytes thanks to @Neil.
Here's a different solution (73 72 bytes):
{[_/""]|{|x|{x|[0]()unless[not(_ in y)]else[1]}if tryPeek y}_|sum|[_=0]}

It's an anonymous function that pulls strings from the stream and checks that the consecutive strings contain same characters. Explanation:
{
    [_/""]|    /* split strings -> creates arrays of characters */
    {|x|       /* begin for loop over character arrays */
        {      /* begin if tryPeek(y) -> peeks the second item from the stream */
               /* x and y are now two consecutive character arrays */
            x| /* push characters in x to the stream */
            [0]()unless[not(_ in y)]else[1] /* pushes 0 to the stream */
                                            /* if y contains the character */
                                            /* in the stream, otherwise 1 */
        }if tryPeek y
    }_|        /* end for loop */
    sum|       /* sum all numbers in the stream */
    [_=0]      /* return true if the sum is zero */
}

It could possibly be golfed more...

Would it help to have a single regexp that does the whole test in one go? Something like ^(\S*(\S)\S* (?=\S*\2))+\S+$.

@Neil That seems to work. Thanks!

Clojure, 71 bytes
(fn[n](every?(fn[[q w]](some q w))(partition 2 1(map #(set(str %))n))))

An anonymous function that accepts a sequence of numbers. Returns true/false.
I like how it reads. There's definitely a few areas that can be improved upon here. My function being passed to map can't easily be changed so that it doesn't require the function macro, which means the entire function can't make use of the macro, which likely added some bytes. It would also be nice if I could figure out a better way of unpacking the values in the every? predicate.
(defn number-chain? [nums]
  (let [; Turn each number into a set of characters
        set-nums (map #(set (str %)) nums)

        ; Partition the sets into lists of neighbors
        ; [1 2 3 4] -> [[1 2] [2 3] [3 4]]
        partitioned (partition 2 1 set-nums)]

    ; Does every second neighbor contain some element of the first?
    (every?
      (fn [[l1 l2]]
        (some l1 l2))
      partitioned)))

SimpleTemplate, 124 bytes
Wow, this was a workout!
{@eachargv asA keyK}{@ifK}{@setR"/[",O,"]/"}{@calljoin intoR"",R}{@ifA is notmatchesR}{@return}{@/}{@/}{@setO A}{@/}{@echo1}

This "simply" makes a regex using the old element, showing 1 as a truthy value, or nothing otherwise.

Ungolfed:
{@each argv as number key K}
    {@if K}
        {@set regex "/[", old, "]/"}
        {@call join into regex "", regex}
        {@if number is not matches regex}
            {@return false}
        {@/}
    {@/}
    {@set old number}
{@/}
{@echo 1}

JavaScript (ES6), 37 bytes
s=>/^(.*(.).*\n(?=.*\2))+.+$/.test(s)

Accepts input as a string of newline-separated numbers. Based on @MartinEnder♦'s excellent Retina answer, but doing the entire test in a single regexp because it's shorter in JavaScript that way.

Bash + Unix utilities, 71 69 bytes
sed "s/\(.*\)/<<<\1 \&\&grepx[\1]/;1s/.*g/g/;\$s/ .*//"|tr 'x
' \ |sh

Try it online!
Input is on stdin, one number per line.
Output is in the exit code: 0 for truthy, 1 for falsey.
This can probably be golfed more.
For the code above to work, there cannot be any file in the current directory whose name is a single digit.  If this isn't acceptable, replace [\1] in the program with '[\1]' (at a cost of 2 additional bytes).
Sample run (the last test case provided in the challenge):
$ echo '98
> 87
> 76
> 11
> 12
> 23' | ./digittest > /dev/null; echo $?
1

(1 here is falsey.)

How it works:
I'll demonstrate on the sample run above.
The sed command converts the input into:
grepx[98]
<<<87 &&grepx[87]
<<<76 &&grepx[76]
<<<11 &&grepx[11]
<<<12 &&grepx[12]
<<<23

The tr command then converts this to the string:
grep [98] <<<87 &&grep [87] <<<76 &&grep [76] <<<11 &&grep [11] <<<12 &&grep [12] <<<23

This string is a shell command for doing the desired operation, so I pipe that into sh and I'm done.

The file restriction is fine, although that's certainly an odd limitation.

Pip, 12 10 bytes
$&B@X^_MPg

Takes input as a series of command-line arguments. Output is a nonempty list for truthy and an empty list for falsey. Try it online or verify all test cases.
Explanation
         g  List of all cmdline args
       MP   Map this function to consecutive pairs of items from that list:
     ^_      Split 1st item of pair into list of characters
    X        Convert to regex that matches any of those characters
  B@         Find all matches in 2nd item of pair
$&          Fold on logical AND--truthy if all items are truthy, falsey if one is falsey
            Print (implicit)

Q, 57 bytes
{r::();({r,::any(last x)in y;x,enlist y}\)($)0,x;all 1_r}

Initialises global r.
Converts input to array of strings.
Scans array checking that some character in last string is in current string.
Appends each result to r.
Returns 1 if all strings satisfy step 3 else returns 0.

Note: 0 appended to start of input array within function. This was done so that the comparison of the first element would be done enlisted. Otherwise, the last character of the first element is grabbed for comparison. Could do a type check however that adds 7 bytes over the current count.

This looks like a similar approach to my Clojure answer. Neat looking language.


text:
Superior Passtimes
Sometimes, when I'm really bored I like to take the sum of an array of non-negative integers. I only take the sum of arrays of lengths that are powers of two. Unfortunately I often make mistakes. Fortunately I keep track of my work as I go along in the following way:
I add pairs of adjacent numbers until there's only one left. For example:
 6 + 18 + 9 + 6 + 6 + 3 + 8 + 10
=  24   +   15  +   9   +   18
=       39      +       27
=               66

You're job is to determine if I've made a mistake somewhere. You may either get input passed to your function or read from standard in. Output can be printed or returned.
Input: An array/list/etc. of non-negative integers, and possibly also the length of that array if your language requires it. That array will be all the numbers read left to right then top to bottom. For example the array above would become:
[[6, 18, 9, 6, 6, 3, 8, 10], [24, 15, 9, 18], [39, 27], [66]]
or
[6, 18, 9, 6, 6, 3, 8, 10, 24, 15, 9, 18, 39, 27, 66] if you prefer.
Output: a single boolean representing whether or not a mistake was made. The boolean can be represented using any mapping provided that all inputs where a mistake is made return/print an identical result and all input which contain no mistakes return/print an identical result. This should go without saying, but those two outputs cannot be the same.
Some Examples of Correct Summations:
6

5+6
=11

  3 + 2 + 4 + 5
=   5   +   9
=       14

[0, 1, 2, 3, 1, 5, 6]

[[1, 2, 4, 8], [3, 12], [15]]

Some Examples of Incorrect Summation:
5+4
=8

4 + 4 + 4 + 4
= 9   +   7
=     16

[[1, 2, 3, 4], [7, 3], [10]]

[3, 4, 5, 6, 7, 8, 9]

Keep in mind that I can make mistakes and still get the right answer. If I do make a mistake it'll never result in an extra number or a missing number in the final array, only a wrong number.
Standard loopholes are forbidden. Shortest answer in each language is a winner. The older answer will win in the case of a tie. I retain the right to decide what the "same language" is, but I'll say upfront a point can't be earned in both Python 2, and Python 3.

Welcome to the site! Nice first challenge.

Why the end date? Languages newer than the challenge are already forbidden by default.

I suppose I could remove it, the idea was that I need to have some cuttoff so I can crown a set of answers as correct, but I guess it doesn't have to be that way.

No, you may use whichever makes golfing easier.

The example [0,1,2,3,1,5,6] is invalid because "Input: An array/list/etc. of positive integers".

Good point, I'll change it to non-negative.

Jelly, 6 bytes
Ṗ+2/€ẇ

Try it online!
How it works
Ṗ+2/€ẇ  Main link. Argument: A (2D array)

Ṗ       Pop; yield A without its last element. Let's call the result B.
  2/    Pairwise reduce...
    €     each array in B...
 +          by addition.
     ẇ  Window exists; test if the result appears in A as a contiguous subarray.

Python 2, 51 bytes
lambda l:map(sum,zip(*[iter(l)]*2))==l[len(l)/2+1:]

Try it online! Thanks to Rod for the test cases.
Takes the whole list flat as input. Groups elements into adjacent pairs using the zip/iter trick, takes the sum of the pairs, and checks if the result equals the second half of the list.
A recursive method came close at 55 bytes:
f=lambda l:len(l)<2or l[0]+l[1]==l[len(l)/2+1]*f(l[2:])

This used that input integers are positive, which has since changed in the spec.

Since the question's conditions now allow non-negative entries, your recursive method will give a false positive for [0,0,1,1,1,1,1].

Röda, 40 bytes
{[0]if{|x|[[x()|[_+_]]=y]if tryPeek y}_}

Try it online!
It's an anonymous function that returns 0 if there are no mistakes and nothing if there are mistakes.
Explanation:
{[0]if{|x|[[x()|[_+_]]=y]if tryPeek y}_}
{                                      } /* Anonymous function */
      {|x|                           }_  /* Loop over lists in the stream */
                         if tryPeek y    /* If there are lists left after this */
            x()                          /* Push values in list x to the stream */
               |[_+_]                    /* Sum every pair of numbers in x */
           [         ]                   /* Create a list of sums */
                      =y                 /* If the list equals to the next list */
          [             ]                /* Push the result */
    if                                   /* If all results are TRUE */
 [0]                                     /* Return 0 */
                                         /* Otherwise return nothing */

Here's a version that is shorter (35 bytes) but against the rules (I think):
{{|x|[[x()|[_+_]]=y]if tryPeek y}_}

Try it online!
It's an anonymous function that reads values from the stream and pushes TRUE or FALSE for each correct line.
I'm not sure if this (multiple return values) is accepted in the rules. Here's my defence: in Röda, conditions of if and while blocks are not boolean values, but streams. A "truthy" stream is either empty or contains only TRUEs, and a "falsy" stream contains one or more FALSEs. In this way, this function returns a "boolean" value. And can be used as a condition of an if statement without any reduce-operations, etc.

I'm not sure if that counts, but for now you have the only Roda solution, so it's hard to say until someone else comes along. I think that that should be fine, but I don't really like the idea of tweaking the rules after the question goes up. Though perhaps one could make a case for it not be a change in rule, so much as  filling in an ambiguity.

@Bijan There are other languages that have a similar construct. In MATL, for example, the whole array is falsey if there is a single 0 in it. I'm not sure exactly how Röda handles that, but it's not unheard of.

@Bijan Our definition of truthy/falsy depends on what the language would do for an if conditional. If this is how Röda works, it complies with our rules, unless the challenge spec overrides the defaults explicitly.

@Dennis It seems that the OP has forbidden this: "all inputs where a mistake is made return/print an identical result and all input which contain no mistakes return/print an identical result." The shorter variation of the program has an infinite number of outputs.

@fergusq Oh, right, I've overlooked that.

Python 2, 69 65 bytes
lambda x:reduce(lambda a,b:(b==map(sum,zip(a[::2],a[1::2])))*b,x)

Try it online!
Returns :
Empty List as Falsy
Total sum as Truthy

Mathematica, 36 bytes
Most[Tr/@#~Partition~2&/@#]==Rest@#&

Pure function taking a nested list as input and returning True or False. The function Tr/@#~Partition~2& takes the pairwise sums of a list, which is then applied (/@#) to each sublist of the input list. The first, second, ... sublists in the resulting list are supposed to equal the second, third, ... sublists in the original input; Most[...]==Rest@# tests for this property.

Python 2, 80 bytes
lambda l:all(l[i+1]==map(sum,zip(l[i][::2],l[i][1::2]))for i in range(len(l)-1))

Try it online!
Not quite as good as the other python answer, but I felt like posting it anyway. This just goes to show why I'm not as good at golfing in regular languages.

JavaScript (ES6), 54 bytes
a=>!a.slice(-a.length/2).some((n,i)=>a[i+=i]+a[i+1]-n)

Takes a flattened array.

05AB1E, 15 12 bytes
¬svyQy2ôO}\P

Try it online!
Explanation
¬             # get the first element from input without popping
 sv      }    # for each element y in input
   yQ         # compare y to the top of the stack
              # leaves 1 on the stack if equal and otherwise 0
     y2ô      # split y in pieces of 2
        O     # sum each pair in the list
          \   # discard the top of the stack (the left over final element of the list)
           P  # product of stack (all the 1's and/or 0's from the comparisons)

Haskell, 82 79 65 bytes
-14 bytes thanks to nimi!
p(x:y:z)=x+y:p z
f x=and.zipWith(==)(drop(length x`div`2+1)x)$p x

Works by comparing the sum each pair of elements to the corresponding element on the next line down. Some bytes can probably be golfed from f, but I can't figure out where.

You can add the two values directly in function p: p(x:y:z)=x+y:p z and then use zipWith(==) instead of zip and combine the list of Bool with and: f x=and.zipWith(==)(drop(length x`div`2+1)x)$p x.

Python 3, 69 68 bytes
lambda v:any(x+v[i-1]-v[(len(v)+i)//2]for i,x in enumerate(v)if i%2)

I know there are already two other python answers... but this one's in python 3, so it's exotic.
This works on a flattened input.
Output:
False if there is no mistake,
True if there is a mistake.

Ruby, 50 bytes
->x{a=b=0;b&&=x[a/2]==x[a]+x[a-1]while x[-a-=2];b}

Reversing the array, any element of the first half (position n) must be the sum of the elements in position n*2 and n*2+1.

Brachylog, 16 13 bytes
s₂ᵘ{{ġ₂+ᵐ}ᵈ}ᵐ

Try it online!
This is just dreadfully long! There has to be some way to not nest inline predicates here.
The predicate succeeds (printing true. as a program) if no mistakes were made and fails (printing false. as a program) otherwise.
s₂ᵘ              Every length 2 substring of the input
   {       }ᵐ    for every element satisfies the following:
    {ġ₂          the pairs of elements of the input
       +ᵐ        when each pair is summed is the output
         }ᵈ      where the input is the first item and the output is the second.

Python 2, 64 bytes
lambda a:[map(int.__add__,x[::2],x[1::2])for x in a[:-1]]==a[1:]

Try it online!
An unnamed function that takes a list of lists (one per line of working as it were), and returns True if no mistakes were made and False otherwise.
It works by using the input without the last entry, a[:-1], to form what the input without the first entry should be and checking that is what was input, ==a[1:].
This formation is achieved by mapping the integer type's addition function, int.__add__, over the pairs of numbers as yielded by two "slices", one slice being every other item starting at the 0th index, x[::2], the other slice being every other item starting at the 1st index, x[1::2].

Pip, 20 19 bytes
$*{{b=$+*Ya<>2}MPa}

This is an anonymous function that takes one argument, a list of lists (e.g. [[1 2 3 4] [3 7] [10]]). Verify all test cases: Try it online!
Explanation
In a Pip function, the first two arguments are assigned to a and b.
  {               }  Anonymous function:
   {          }MPa    To each pair of sublists from a, map this helper function:
          a<>2         Group the 1st member of the pair into 2-item sublists
         Y             Yank that value (no-op used to override precedence order)
      $+*              Map (*) the fold ($) on addition (+) operator
    b=                 If the 2nd member of the pair is = to the result, 1; else 0
$*                   Modify the outside function by folding its return value on *
                     (makes a list containing all 1's into 1 and any 0's into 0)

For example:
a
[[1 2 3 4] [7 3] [10]]

{...}MP
a:[1 2 3 4] b:[7 3]
a:[7 3]     b:[10]

a<>2
[[1 2] [3 4]]
[[7 3]]

$+*
[3 7]
[10]

b=
0
1

Final result of {...}MPa
[0 1]

$*
0

PHP, 96 95 bytes:
using builtins:
function f($a){return!$a[1]||array_pop($a)==array_map(array_sum,array_chunk(end($a),2))&f($a);}
// or
function f($a){return!$a[1]||array_map(array_sum,array_chunk(array_shift($a),2))==$a[0]&f($a);}

recursive functions return true or false.
breakdown for first function:
function f($a){
    return!$a[1]||      // true if array has no two rows ... or
    array_pop($a)==     // remove last row, true if equal to
    array_map(array_sum,    // 3. sum up every chunk
        array_chunk(        // 2. split to chunks of 2
            end($a)         // 1. new last row
        ,2))
    &f($a);             // and recursion returns true
}

older solutions (96 bytes each) using loops:
function f($a){foreach($a[0]as$k=>$v)$b[$k/2]+=$v;return$b==$a[1]&&!$a[2]|f(array_slice($a,1));}
//or
function f($a,$y=0){foreach($a[$y]as$k=>$v)$b[$k/2]+=$v;return$b==$a[++$y]&&!$a[$y+1]|f($a,$y);}

breakdown for last function:
function f($a,$y=0){
    foreach($a[$y]as$k=>$v)$b[$k/2]+=$v;    // build $b with correct sums from current row
    return$b==$a[++$y]                      // true if $b equals next row
    &&!$a[$y+1]                             // and (finished
        |f($a,$y);                          //      or recursion returns true)
}

iterative snippets, 81 bytes
for(;$a[1];)if(array_pop($a)!=array_map(array_sum,array_chunk(end($a),2)))die(1);
for(;$a[1];)if(array_map(array_sum,array_chunk(array_shift($a),2))!=$a[0])die(1);
for(;$a[++$y];$b=[]){foreach($a[$y-1]as$k=>$v)$b[$k/2]+=$v;if($a[$y]!=$b)die(1);}

assume array predefined in $a; exits with error if it is incorrect.

R, 92 77 bytes
Anonymous function which takes a flat sequence of numbers as input. Returns TRUE or FALSE as appropriate. Uses the same approach conceptually as xnor's python answer.
function(x,l=sum(1|x)/2)all(rowSums(cbind(x[1:l*2-1],x[1:l*2]))==tail(x,l-1))

Previous solution, using the rollapply function from the zoo package, and taking input as a list, e.g. list(c(6, 18, 9, 6, 6, 3, 8, 10), c(24, 15, 9, 18), c(39, 27), c(66)):
function(l,T=1){for(i in 2:length(l))T=T&all(zoo::rollapply(l[[i-1]],2,sum,by=2)==l[[i]]);T}

C, 54 bytes:
f(int*s,int*e){return e-s>1?*s+s[1]-*e||f(s+2,e+1):0;}

Ungolfed:
int f(int*s,int*e) {
    if(e-s>1) {
        return *s+s[1] != *e || f(s+2,e+1);
    } else {
        return 0;
    }
}

Test with
#include <assert.h>
int main() {
    int input1[15] = {6, 18, 9, 6, 6, 3, 8, 10, 24, 15, 9, 18, 39, 27, 66};
    assert(!f(input1, input1+8));

    int input2[7] = {3, 4, 5, 6, 7, 8, 9};
    assert(f(input2, input2+4));
}

As you see, f() returns true for invalid inputs and false (= 0) for valid ones.
As always, recursion is less bytes than iteration, so f() is recursive, even though it takes two iterators as arguments. It works by repeatedly comparing the sum of two integers at s to one integer at e, ignoring the level boundaries, and carrying on until the two iterators meet. I have also used some boolean zen together with the fact that any non-zero integer value is considered true in C to further shorten the code.

JavaScript (ES6), 46 44 bytes
Takes input as a flattened array. Returns NaN for valid or 0 for invalid.
f=([a,b,...c])=>a+b==c[c.length>>1]?f(c):b-b

Test

f=([a,b,...c])=>a+b==c[c.length>>1]?f(c):b-b

console.log(f([6, 18, 9, 6, 6, 3, 8, 10, 24, 15, 9, 18, 39, 27, 66])) // NaN
console.log(f([0, 1, 2, 3, 1, 5, 6]))                                 // NaN
console.log(f([1, 2, 4, 8, 3, 12, 15]))                               // NaN
console.log(f([1, 2, 3, 4, 7, 3, 10]))                                // 0
console.log(f([3, 4, 5, 6, 7, 8, 9]))                                 // 0

PHP, 102 Bytes
input als url parameter in this format ?0=[1,2,3]&1=[3,3]&2=[6]
 use this input [[int,int],[int]]
<?$r=[$_GET[0]];for(;count(end($r))>1;)$r[]=array_map(array_sum,array_chunk(end($r),2));echo$r==$_GET;

Breakdown
$r=[$_GET[0]]; # Set the first item of the input in the result array
for(;count(end($r))>1;) # till the last item in the result array has only one int
$r[]=array_map(array_sum,array_chunk(end($r),2));# add the next item to the result array
echo$r==$_GET; # compare the input array with the result array

Japt, 10 bytes
Takes input as a 2-D array.
äÏeXò mxÃe

Try it
äÏeXò mxÃe     :Implicit input of 2-D array
ä              :Reduce each consecutive pair of sub-arrays
 Ï             :By passing them through the following function as X & Y, respectively
  e            :  Test Y for equality with
   Xò          :    Split X on every 2nd element
      m        :    Map
       x       :      Reduce by addition
        Ã      :End function
         e     :All true?


text:
λ-calculus to js arrow notation transpiler
Not an interpreter. Arguably a compiler. But I'm talking about a transpiler.
It can be in any language, but it must return js-valid arrow notation code.
The λ-calculus string would be passed as an argument to a function, or the whole program, and in some way the program would return/log/print the string with the js-notation.
Whitespace is not important, if it makes the writing easier.
Only accepted answers are with curry notation for output, not multiple parameters. The λ-calculus notation shorthand for multiple parameters must be considered.
All identifiers will be separated either by a  (space), a λ, a . or () (parentheses). They can be more than a single character. Note that if the language has issues with keeping track of characters like λ, then you can cut yourself some slack and use \.
The transpiler doesn't have to evaluate the expression to simplify it, but as long as the statement is equivalent, I'll allow it. It won't gain any extra points.
All unneeded parenthesis can be taken out. x=>x is just as valid as (x=>x) which is just as valid as ((x)=>x) or (x)=>x.
Using non arrow-function javascript features is disallowed, although if you come up with interesting hacks, they might be worth checking out, so feel free to ask if you have something creative.
Efficiency isn't really important, as long as vaguely practical, so answer with least amount of bytes wins
Examples:
λx.x                -> (x)=>x
λx y.x(y)           -> (x)=>(y)=>x(y)
λx.λy.x(y)          -> (x)=>(y)=>x(y)
λs z.s(s z)         -> (s)=>(z)=>s(s(z))
λfoo bar.foo bar    -> (foo)=>(bar)=>foo(bar)
(λa b c.b c a) x y -> ((a)=>(b)=>(c)=>(b(c)(a)))(x)(y)

Are the legal JS forms which do not use excess ()s also fine? i.e. λx.x -> x=>x?

yeah. Added them in for clarity. I'll specify it

You should talk about the precise definition of a lambda so that the post is self-contained and on-topic.

@ConorO'Brien how do you suggest I should do that? Post a few resources indicating what lambda calculus is? Maybe just the wiki page? If there was any question of ambiguity, I would have thought that the examples would answer them

I agree with Conor. Without an in-challenge explanation of how lambda calculus works, this challenge isn't standalone, and thus is unclear.

Any edits or suggestions on how to make it clearer are welcome. I honestly thought adding a list of inputs and outputs was good enough, whether or not you understand lc