Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Code golf thread?

Name: Anonymous 2012-04-30 23:37

Anybody up for some code golf? I'm bored and I want to abuse scripting languages...

Name: Anonymous 2012-05-01 6:37

Sure. We need a challenge, though.

Name: Anonymous 2012-05-01 13:30

/prog/ can't even get regular code to work most of the time. What makes you think they could write interestingly golfed code?

Name: Anonymous 2012-05-01 13:42

>>2
clahgenge:
try to rwite ProGRAM that destroy world

Name: Anonymous 2012-05-01 14:10

The Challenge:

Implement Rule-110.
Here's a reference-implementation in HASKALL:


import Data.List

groupsOf :: Int -> [a] -> [[a]]
groupsOf n xs = take (length xs' - n) xs'

    where xs'
= map (take n) (tails xs)

step :: [Bool] -> [Bool]
step xs = map next (groupsOf 3 xs'
)
    where xs'
= [False] ++ xs ++ [False]
           
next :: [Bool] -> Bool
next [True,  True,  True ] = False
next [True,  False, False] = False
next [False, False, False] = False
next _                     = True

rule110 :: [Bool] -> [[Bool]]
rule110 = iterate step

main :: IO ()
main = mapM_ putStrLn xs
    where xs      = map (map f) (rule110 $ replicate 49 False ++ [True])
          f True  = '#'
          f False = ' '

Name: Anonymous 2012-05-01 14:49

>>5
Back to hackernews, please.

Name: Anonymous 2012-05-01 17:05

This J code advances a bitwise vector v to its next generation in rule R:

v=.0<R(17 b.)2^#.|:(,.i:1)|.v

Substitute 110 for R, here. I'm too lazy to write a full program.

Name: Anonymous 2012-05-01 23:45

How about you fagstorms stop making up that abstract computer theory ``bullshite" of yours and start contributing to society.

Name: bampu pantsu 2012-05-29 4:42

bampu pantsu

Don't change these.
Name: Email:
Entire Thread Thread List