Skip to content

Instantly share code, notes, and snippets.

@chris-x86-64
Created May 31, 2018 03:07
Show Gist options
  • Save chris-x86-64/2399ec3a8a4a1c86e13229eacab4a745 to your computer and use it in GitHub Desktop.
Save chris-x86-64/2399ec3a8a4a1c86e13229eacab4a745 to your computer and use it in GitHub Desktop.
import sys
import random
ZUN = 'ズン'
DOKO = 'ドコ'
KIYOSHI = 'キヨシ!'
class ZunDoko(object):
def __init__(self):
self.words = list()
def _get_zun_or_doko(self):
return random.choice((ZUN, DOKO))
def loop(self):
while True:
word = self._get_zun_or_doko()
self.words.append(word)
if len(self.words) > 5:
self.words = self.words[-5:]
print(self.words)
if self.words == [ZUN, ZUN, ZUN, ZUN, DOKO]:
print(KIYOSHI)
sys.exit(0)
else:
continue
if __name__ == "__main__":
zundoko = ZunDoko()
zundoko.loop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment