Created
March 12, 2016 05:49
-
-
Save rotelstift/afe3cd36926d56c86e1e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| def sing | |
| if Random.rand > 0.5 then | |
| print("ズン ") | |
| return 1 | |
| else | |
| print("ドコ") | |
| return 0 | |
| end | |
| end | |
| ###### main ###### | |
| kiyoshi = "き・よ・し!" | |
| zun_counter = 0 | |
| sang = 0 | |
| # 『ズン』が4回以上繰り返され、『ドコ』が出力された時に終わるループ | |
| # 『ズン』が4回未満のときに『ドコ』が出たら『ズン』のカウントはリセットされる | |
| until zun_counter >= 4 && sang == 0 do | |
| if sang == 0 then | |
| zun_counter = 0 | |
| print("\r") | |
| print(" ") | |
| print("\r") | |
| end | |
| sang = sing() | |
| zun_counter = zun_counter + sang | |
| sleep(1) | |
| end | |
| print("\n") | |
| puts(kiyoshi) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment