r/tinycode • • Jul 20 '11

Ruby: Snake in 9 Lines of Code

http://pastebin.com/QqZYby5N
0 Upvotes

5 comments sorted by

12

u/tytdfn Jul 21 '11

It's 9 lines but those are formatted in an ugly manner

8

u/Ran4 Jul 21 '11

554 character lines?... No, 9 lines of code means a maximum of 9·80 chars.

15

u/sihnon Jul 21 '11

As far as I'm concerned, it doesn't count as only 9 lines when it's been formatted like that. It is clearly more than 9 lines of code, just with all useful whitespace removed to make it difficult to read.

That said... still pretty cool and less code than I'd have expected.

2

u/densets Jul 21 '11

That's why you have to measure it on kb.

2

u/nexe mod Jul 21 '11 edited Jul 21 '11

As I looked at the code closer I saw that it is in fact written very longish ... I will rewrite it this evening or in the next few days and post an update. ;)

EDIT: http://www.reddit.com/r/tinycode/comments/iwb29/snake_in_11_lines_of_ruby/

3

u/trashbox Jul 21 '11

This reminds me of something I did a couple years back, a pipes screensaver in Bash.

1

u/nexe mod Jul 21 '11

I learned something from that code none the less. I like it :) .. Maybe I'll use it to create something similar, better looking ..