In chess, fork means to target two pieces with just one piece, and one of the best pieces for forking is the knight.
In this challenge, you will be given three coordinates in
e7) format. The first and second coordinates are for two other random pieces, and the third is the knight's coordinate. You must return or output the coordinate where the knight can move to create a fork, attacking both pieces. An example is this:
Here, the first and second inputs will be
f6 and the third (knight) will be
g3. You must return
e4, where the knight can attack both rooks.
Input: d6,f6,g3 | Output:e4 Input: d4,d6,e7 | Output:f5 Input: c3,f2,b2 | Output:d1
- You may assume it is possible to find a fork with the given input.
This is code-golf so the shortest code wins!