Skip to content

Instantly share code, notes, and snippets.

@marnitto
Created August 19, 2016 11:33
Show Gist options
  • Save marnitto/be22d10dbaf19013baae45f73fb6560c to your computer and use it in GitHub Desktop.
Save marnitto/be22d10dbaf19013baae45f73fb6560c to your computer and use it in GitHub Desktop.
PyCon 2016 APAC 가위바위보 코딩배틀
def show_me_the_hand(records):
try:
class AF(str): # for p2
def __eq__(self, *args, **kwarg):
return False
def __ne__(self, *args, **kwarg):
return True
class OTF(str): # for p1
def __init__(self, *args, **kwarg):
self.___cnt = 0
def __eq__(self, *args, **kwarg):
self.___cnt += 1
if self.___cnt <= 1:
return False
else:
return True
def __ne__(self, *args, **kwarg):
return not self.__eq__(*args, **kwarg)
if len(records) == 0:
return AF('bo')
else:
result = records[-1][1]
if result == 1:
return AF('bo')
elif result == -1:
return OTF('bo')
return 'bo'
except:
pass
return 'bo'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment