Help me untangle these wires!
Pyth - 26 25 bytes
Very straightforward, maybe I can golf the filtering.
fhhT_m+hB/xrdZ\x2@"RL"}\x
Try it online here.
JavaScript (ES6), 178 bytes
f=([t,...a],r=[])=>a[0]?t.replace(/x/gi,(c,i)=>(c=c<'x'?'R':'L',i=++i/2,r.reduce((f,[j,,d],n)=>f||i<j+2&&j<i+2&&(j-i|c==d||r.splice(n,1)&&2),0)<2?r=[[i,i+1,c],...r]:r))&&f(a,r):r
Takes input as an array of strings representing lines and returns an array of arrays of values e.g. [[2, 3, "R"], [3, 4, "L"], [1, 2, "R"]]
. The reverse ordering helps with the eliminations.
Python 2, 244 241 bytes
m=[]
for l in input():
for i in range(len(l)):
c=l[i];a=i/2+1;L,R=[a,a+1,'LR'[c>'v']],[a,a+1,'RL'[c>'v']];x=m.index(L)if L in m else-1;M=zip(*m[:x+1])
if c in'xX':
if x>=0and(a in M[1]or a+1in M[0])<1:del m[x]
else:m=[R]+m
print m
Takes input as list of strings
Example:
Input: ['| | | |', ' X | |', '| | x ', '| X |', ' x | |']
Output: [[1, 2, 'L'], [2, 3, 'R'], [3, 4, 'L'], [1, 2, 'R']]
Edit: Fixed for case:
Input: ['| | |', ' X |', ' X |', ' x |', '| X', ' X |', ' x |', ' x |', '| | |']
Output: [[1, 2, 'L'], [2, 3, 'R'], [1, 2, 'R']]