Guest User

Untitled

a guest
Oct 22nd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. import random
  2.  
  3. ZUN = "zun"
  4. DOKO = "doko"
  5. MAXLEN = 5
  6.  
  7. def match(arr):
  8. print(arr)
  9.  
  10. if (len(arr) >= MAXLEN
  11. and arr[0] == ZUN
  12. and arr[1] == ZUN
  13. and arr[2] == ZUN
  14. and arr[3] == ZUN
  15. and arr[4] == DOKO):
  16. return True
  17. return False
  18.  
  19. def zundoko():
  20. words = []
  21. counter = 0
  22.  
  23. ZUNDOKO = [ZUN,DOKO]
  24. KIYOSHI = "kiyoshi!"
  25.  
  26. while (not match(words)):
  27. counter += 1
  28. words.append(ZUNDOKO[random.randint(0,1)])
  29. if len(words) > MAXLEN:
  30. words.pop(0)
  31.  
  32. print(KIYOSHI)
  33. print(counter)
  34.  
  35.  
  36. if __name__ == '__main__':
  37. zundoko()
Add Comment
Please, Sign In to add comment