Created
May 31, 2018 03:07
-
-
Save chris-x86-64/2399ec3a8a4a1c86e13229eacab4a745 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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