# No More Jockeys - CodeGolf Version

This challenge is inspired by the game No More Jockeys.

The input is a list of tuples of natural numbers (potentially including 0), in some appropriate input format. Starting with player 0 and alternating with player 1, each player chooses some number which is contained within at least one remaining tuple, and all tuples containing that number will be removed from the list. The first player who has no possible moves loses.

Your challenge is to implement a function to calculate the minimax value of a given input. Return a truthy value if it is player 1 to win given optimal play by both players, and a falsy value if it is player 0 to win. The converse is also acceptable.

This is , so fewest bytes wins.

## Test Cases

((), (0, 1, 3), (1,)) -> 0
() -> 1
((0,), (1, 3), (2,)) -> 0
((), (0, 1), (0, 1, 2), (0, 2), (1,)) -> 1
((0,), (0, 1, 3), (0, 3), (2,)) -> 0
((), (0, 1), (0, 2, 3), (1,), (2,), (3,)) -> 1
((0, 1), (1, 2), (2, 3), (3,)) -> 0
((0, 2), (1,), (1, 3), (3,), (4,)) -> 1
((0, 2, 3), (0, 3), (1,), (2,), (2, 3)) -> 0

• May we take the inner tuples as set objects?
– xnor
Apr 20, 2021 at 22:25
• @xnor OK, that's fine. Apr 20, 2021 at 22:34

# Python 3, 62 bytes

f=lambda a:0in(f([x for x in a if{r}-{*x}])for r in sum(a,()))


Try it online!

# Python 2, 61 bytes

f=lambda a:0in(f(filter({y}.__sub__,a))for x in a for y in x)


Try it online!

-5 bytes thanks to Unrelated String
-6 bytes thanks to dingledooper
-1 byte if we use Python 2 thanks to dingledooper
-2 bytes thanks to xnor

Outputs True for player 0 winning and False or () for player 1 winning (() is an empty tuple in Python, which is a falsey value in the language)

• -5 Apr 20, 2021 at 22:29
• Apr 20, 2021 at 22:59
• It seems to pass all the test cases even after removing the a and... condition, saving 6 bytes. It also correctly returns False for that empty tuple. Apr 21, 2021 at 0:06
• @dingledooper oh right, that makes sense for how all works. thanks Apr 21, 2021 at 0:11
• There's also a -1 byte save in Python 2, but that's all I can find now. Apr 21, 2021 at 0:24

# JavaScript (ES10), 54 bytes

Returns a Boolean value.

f=a=>!a.flat().some(v=>f(a.filter(b=>!b.includes(v))))


Try it online!

f a=any(not.f.(filtera).notElem)$a>>=id  Try it online! Was the same length as using nested list comprehensions, until I realized notElem exists, and is much shorter than (not.).elem. Still feels very golfable... # J, 37 bytes (0=1#.]$:@#~1-~.@;e.&>/])1:@.(''-:;)


Try it online!

# Jelly, 9 bytes

iÐḟⱮẎß€0e


Try it online!

My first attempt repeatedly segfaulted, but now that I have a very close translation of hyper-neutrino's Python solution it seems to work fine.

I would be remiss to let this get accepted without an explanation!

   Ɱ         For each element of
Ẏ        the input flattened a level,
Ðḟ          yield the input without elements which
i            contain the element in question.
ß€      Recur on each result.
0e    Is one of those results 0?
`