Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
4 Add suggestion
source | link

Python 3, 135 129129 84 bytes

-4 bytes thanks to Mr. Xcoder!

-42 bytes thanks to Daniel Schepler!

defg=lambda g(s,l):n=len(s);u=[i for i in l if~-(s in{*l}-{i})*(i[:n]==s)];return~len(u)and~(len(u[0])-n)%2oror-min(g(i[:n+1]w,l)for iw in{w[:len(s)+1]for uw in l if w[:len(s)]==s})

Try it online!Try it online!

A 1 indicates the current player will win, whereas a -1 indicates they will lose.

Python 3, 135 129 bytes

-4 bytes thanks to Mr. Xcoder!

def g(s,l):n=len(s);u=[i for i in l if~-(s in{*l}-{i})*(i[:n]==s)];return~len(u)and~(len(u[0])-n)%2or-min(g(i[:n+1],l)for i in u)

Try it online!

A 1 indicates the current player will win, whereas a -1 indicates they will lose.

Python 3, 135 129 84 bytes

-4 bytes thanks to Mr. Xcoder!

-42 bytes thanks to Daniel Schepler!

g=lambda s,l:(s in l)or-min(g(w,l)for w in{w[:len(s)+1]for w in l if w[:len(s)]==s})

Try it online!

A 1 indicates the current player will win, whereas a -1 indicates they will lose.

3 Add suggestions
source | link

Python 3, 135135 129 bytes

-4 bytes thanks to Mr. Xcoder!

def g(s,l):n=len(s);u=[i for i in l if if~-(s not in{*l}-{i}and )*(i[:n]==s];return lenn]==s)];return~len(u)<2and~and~(len(u[0])-n)%2or 1-min(g(i[:n+1],l)for i in u)

Try it online!Try it online!

A 1 indicates the current player will win, whereas a 0-1 indicates they will lose.

Python 3, 135 bytes

def g(s,l):n=len(s);u=[i for i in l if s not in{*l}-{i}and i[:n]==s];return len(u)<2and~(len(u[0])-n)%2or 1-min(g(i[:n+1],l)for i in u)

Try it online!

A 1 indicates the current player will win, whereas a 0 indicates they will lose.

Python 3, 135 129 bytes

-4 bytes thanks to Mr. Xcoder!

def g(s,l):n=len(s);u=[i for i in l if~-(s in{*l}-{i})*(i[:n]==s)];return~len(u)and~(len(u[0])-n)%2or-min(g(i[:n+1],l)for i in u)

Try it online!

A 1 indicates the current player will win, whereas a -1 indicates they will lose.

2 -3 bytes and output specification
source | link

Python 3, 138135 bytes

def g(s,l):n=len(s);u=[i for i in l if i[:n]nots not in{*l}-{i}and i[:n]==s];return len(u)<2and~(len(u[0])-n)%2or 1-min(g(i[:n+1],l)for i in u)

Try it online!Try it online!

A 1 indicates the current player will win, whereas a 0 indicates they will lose.

Python 3, 138 bytes

def g(s,l):n=len(s);u=[i for i in l if i[:n]not in{*l}-{i}and i[:n]==s];return len(u)<2and~(len(u[0])-n)%2or 1-min(g(i[:n+1],l)for i in u)

Try it online!

Python 3, 135 bytes

def g(s,l):n=len(s);u=[i for i in l if s not in{*l}-{i}and i[:n]==s];return len(u)<2and~(len(u[0])-n)%2or 1-min(g(i[:n+1],l)for i in u)

Try it online!

A 1 indicates the current player will win, whereas a 0 indicates they will lose.

1
source | link