1 of 7
Kevin Cruijssen
• 91.7k
• 8
• 120
• 318

#05AB1E, 34 bytes

gFÐNè©2@iNx1.S-èDÄ2‹*®3Qi±>}Nǝ]O.±


Uses an integer-array as input with A=-1, B=1, N=0, X=2, Y=3 and outputs -1 if A wins and 1 if B wins.

Can probably be golfed a bit more..

Explanation:

g             # Take the length of the (implicit) input-list
F            # Loop N in the range [0, length):
Ð           #  Triplicate the list (which is the implicit input-list in the first iteration)
Nè         #  Get the N'th item of the list
©        #  Store it in the register (without popping)
2@i        #  If it's larger or equal to 2 (so either 2 or 3):
Nx      #   Push N and N doubled both to the stack
1.S   #   Compare the double integer with 1 (-1 if N*2<1; 0 if N*2==1; 1 if N*2>1)
#   (So if it's the first iteration (N=0), this will be -1, otherwise it will be 1)
-  #   Subtract that from the index
è #   And index it into the list to get the next or previous item
DÄ2‹    #   Check if that value is -1, 0, or 1 (abs(i) < 2) (1 if truthy; 0 if falsey)
*   #   And multiply that with the indexed next/previous item
®3Qi  } #   If the N'th value (from the register) was a 3:
±>  #    Bitwise-NOT + 1 it (1 becomes -1; 0 remains 0; 1 becomes -1)
Nǝ      #   And replace the N'th value with this
]            # Close both the if-statement and loop
O           # Sum the modified list (which now only contains -1, 0, or 1)
.±         # And take its signum (-1 if negative; 0 if 0; 1 if positive)

Kevin Cruijssen
• 91.7k
• 8
• 120
• 318