News for hackers. Stuff that matters.
Re:Conway's Game of Life in 140 bytes Ruby by tomstuart on Saturday February 11, 2012 @02:13PM (#3579880)
Off the top of my head, some simple ways to make this shorter:

  * Use 0...s*s instead of 0..s*s-1
  * Use 0..s*s instead of 0...s*s (overrunning g doesn't matter much)
  * Use count{|x|x} instead of compact.count
  * Get rid of ||nil (because count{|x|x} ignores all falsy values)
  * Get rid of the brackets around g[i]&&n==2
  * Use [g[i-s-1,3],g[i-1],g[i+1],g[i+s-1,3]].flatten instead of [[g[i-s-1],g[i-s],g[i-s+1],g[i-1],g[i+1],g[i+s-1],g[i+s],g[i+s+1]]
  * Use -1..s*s instead of 0..s*s and substitute i+1 for i (i.e. g[i+1] instead of g[i], but [g[i-s,3],g[i],g[i+2],g[i+s,3]] instead of [g[i-s-1,3],g[i-1],g[i+1],g[i+s-1,3]])
Re:Conway's Game of Life in 140 bytes Ruby by elitheeli on Saturday February 11, 2012 @02:57PM (#3580011)
I really should have refreshed the comments page before shortening... seems like we think similarly: https://gist.github.com/1803557
Re:Conway's Game of Life in 140 bytes Ruby by eddie_the_head on Saturday February 11, 2012 @06:14PM (#3580468)
And in APL:

life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ }

Re:Conway's Game of Life in 140 bytes Ruby by peteretep on Saturday February 11, 2012 @02:08PM (#3579870)
And in 131 characters of Perl: https://gist.github.com/1803656

What do I win?

Re:Conway's Game of Life in 140 bytes Ruby by peteretep on Saturday February 11, 2012 @02:08PM (#3579873)
Actually, what I /really/ won was the happy feeling I got from abusing $a and $b even though it runs under strict.
Re:Conway's Game of Life in 140 bytes Ruby by Cushman on Saturday February 11, 2012 @02:26PM (#3579917)
It's all ASCII... If you're using octets for each character, you can definitely still squeeze a few bytes out of that.
Re:Conway's Game of Life in 140 bytes Ruby by samwilliams on Sunday February 12, 2012 @08:36AM (#3581758)
Those interested in this post may like the examples on this page: http://codegolf.stackexchange.com/questions/3434/shortest-ga...
Re:Conway's Game of Life in 140 bytes Ruby by raganwald on Saturday February 11, 2012 @05:42PM (#3580398)
Re:Conway's Game of Life in 140 bytes Ruby by namidark on Saturday February 11, 2012 @05:13PM (#3580329)
None of these examples ran with 1.9.3 :\
Re:Conway's Game of Life in 140 bytes Ruby by netmute on Saturday February 11, 2012 @10:08PM (#3580984)
OP here. I'm pretty sure they run in 1.9.3 because I wrote them in it.