Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 6 characters in body
Source Link
Wheat Wizard
  • 102.8k
  • 23
  • 299
  • 697

Haskell, (削除) 175 (削除ここまで) 158(削除) 158 (削除ここまで) 154 bytes

t=take 16
f=t0ドル:f
p s(a:b)=s%!s=s<$>p(a:a:b)
s%p(a:b:c:d)=s=(4*a+2*b+c):s%p(b:c:d)
s%[ap[a,b]=[s4ドル*a+3*b]b]=[4*a+3*b]
m s=putStr"P1 33 16 ">>mapM_ print`mapM_`t(iterate(p!(s!!))$f++1:f)

Try it online! Try it online!

Outputs to a pbm file with white being off and black being on. You can switch the on and off colors at no cost to bytes.

Sample outputs

Rule 30

Rule 121

Haskell, (削除) 175 (削除ここまで) 158 bytes

t=take 16
f=t0ドル:f
p s(a:b)=s%(a:a:b)
s%(a:b:c:d)=s(4*a+2*b+c):s%(b:c:d)
s%[a,b]=[s4ドル*a+3*b]
m s=putStr"P1 33 16 ">>mapM_ print`mapM_`t(iterate(p(s!!))$f++1:f)

Try it online!

Outputs to a pbm file with white being off and black being on. You can switch the on and off colors at no cost to bytes.

Sample outputs

Rule 30

Rule 121

Haskell, (削除) 175 (削除ここまで) (削除) 158 (削除ここまで) 154 bytes

t=take 16
f=t0ドル:f
(a:b)!s=s<$>p(a:a:b)
p(a:b:c:d)=(4*a+2*b+c):p(b:c:d)
p[a,b]=[4*a+3*b]
m s=putStr"P1 33 16 ">>mapM_ print`mapM_`t(iterate(!(s!!))$f++1:f)

Try it online!

Outputs to a pbm file with white being off and black being on. You can switch the on and off colors at no cost to bytes.

Sample outputs

Rule 30

Rule 121

Fixed bug that occasionally effected the right side
Source Link
Wheat Wizard
  • 102.8k
  • 23
  • 299
  • 697

Haskell, (削除) 175 (削除ここまで) 156158 bytes

t=take 16
f=t0ドル:f
p s(a:b)=s%(a:a:b)
s%(a:b:c:d)=s(4*a+2*b+c):s%(b:c:d)
s%[a,b]=[s6ドル*a+b]b]=[s4ドル*a+3*b]
m s=putStr"P1 33 16 ">>mapM_ print`mapM_`t(iterate(p(s!!))$f++1:f)

Try it online! Try it online!

Outputs to a pbm file with white being off and black being on. You can switch the on and off colors at no cost to bytes.

Sample outputs

Rule 30

Rule 121

Haskell, (削除) 175 (削除ここまで) 156 bytes

t=take 16
f=t0ドル:f
p s(a:b)=s%(a:a:b)
s%(a:b:c:d)=s(4*a+2*b+c):s%(b:c:d)
s%[a,b]=[s6ドル*a+b]
m s=putStr"P1 33 16 ">>mapM_ print`mapM_`t(iterate(p(s!!))$f++1:f)

Try it online!

Outputs to a pbm file with white being off and black being on. You can switch the on and off colors at no cost to bytes.

Sample outputs

Rule 30

Rule 121

Haskell, (削除) 175 (削除ここまで) 158 bytes

t=take 16
f=t0ドル:f
p s(a:b)=s%(a:a:b)
s%(a:b:c:d)=s(4*a+2*b+c):s%(b:c:d)
s%[a,b]=[s4ドル*a+3*b]
m s=putStr"P1 33 16 ">>mapM_ print`mapM_`t(iterate(p(s!!))$f++1:f)

Try it online!

Outputs to a pbm file with white being off and black being on. You can switch the on and off colors at no cost to bytes.

Sample outputs

Rule 30

Rule 121

deleted 56 characters in body
Source Link
Wheat Wizard
  • 102.8k
  • 23
  • 299
  • 697

Haskell, 175(削除) 175 (削除ここまで) 156 bytes

t=take 16
f=t0ドル:f
p s(a:b)=s%(a:a:b)
s%(a:b:c:d)=s(4*a+2*b+c):s%(b:c:d)
s%[a,b]=[s6ドル*a+b]
n=putStrLn
m s=n"P3s=putStr"P1 33 16 1">>mapM_((n"0">>mapM_ 0">>).print)`mapM_`tprint`mapM_`t(iterate(p(s!!))$f++1:f)

Try it online! Try it online!

Outputs to a ppmpbm file with bluewhite being onoff and black being offon. You can adjust the colors somewhat but blue is the golfiest ofswitch the primaryon and off colors at no cost to bytes.

Sample outputs

Rule 30

Rule 121

Haskell, 175 bytes

t=take 16
f=t0ドル:f
p s(a:b)=s%(a:a:b)
s%(a:b:c:d)=s(4*a+2*b+c):s%(b:c:d)
s%[a,b]=[s6ドル*a+b]
n=putStrLn
m s=n"P3 33 16 1">>mapM_((n"0 0">>).print)`mapM_`t(iterate(p(s!!))$f++1:f)

Try it online!

Outputs to a ppm file with blue being on and black being off. You can adjust the colors somewhat but blue is the golfiest of the primary colors.

Sample outputs

Rule 30

Rule 121

Haskell, (削除) 175 (削除ここまで) 156 bytes

t=take 16
f=t0ドル:f
p s(a:b)=s%(a:a:b)
s%(a:b:c:d)=s(4*a+2*b+c):s%(b:c:d)
s%[a,b]=[s6ドル*a+b]
m s=putStr"P1 33 16 ">>mapM_ print`mapM_`t(iterate(p(s!!))$f++1:f)

Try it online!

Outputs to a pbm file with white being off and black being on. You can switch the on and off colors at no cost to bytes.

Sample outputs

Rule 30

Rule 121

Source Link
Wheat Wizard
  • 102.8k
  • 23
  • 299
  • 697
Loading

AltStyle によって変換されたページ (->オリジナル) /