Misère Nim

  • + 0 comments

    def misereNim(s):

    xor = reduce((lambda x, y: x ^ y), s)
    if max(s) == 1:
        return "First" if xor == 0 else "Second"
    else:
        return "Second" if xor == 0 else "First"