Last active
August 29, 2015 14:26
-
-
Save 5t111111/63cf622b2779d6c7e0df 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
| class Doala | |
| def move(number) | |
| hand = -> (n) { n % 2 == 0 ? '⌒' : 'ー' } | |
| f = Fiber.new do | |
| n = 0 | |
| reverse = false | |
| line_length = 50 | |
| loop do | |
| line = "\r" + " " * n + '(' + hand.call(n) + '(´・△・`)' + hand.call(n) + '⌒)' | |
| line_fill = 50 - line.length | |
| Fiber.yield(line + " " * line_fill) | |
| sleep 0.1 | |
| if reverse | |
| n -= 1 | |
| else | |
| n += 1 | |
| end | |
| reverse = true if n == line_length / 2 | |
| reverse = false if n == 0 | |
| end | |
| end | |
| number.times do | |
| print f.resume | |
| end | |
| end | |
| end | |
| Doala.new.move 200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment