Skip to main content
added 1274 characters in body
Source Link
Vitaliy Kaurov
  • 1.6k
  • 14
  • 19

Mathematica ASCII

I really like ASCII art, so I add another very different answer - especially so it's so short in Mathematica:

Column[Table[Row[RandomChoice[{"+", ".", "*", "~", "^", "o"}, k]], {k, 1, 35, 2}], 
Alignment -> Center]

enter image description here

And now with a bit more sophistication a scalable dynamic ASCII tree. Watch closely - the tree is also changing - snow sticks to branches then falls ;-)

DynamicModule[{atoms, tree, pos, snow, p = .8, sz = 15},
 
 atoms = {
   Style["+", White],
   Style["*", White],
   Style["o", White],
   Style[".", Green],
   Style["~", Green],
   Style["^", Green],
   Style["^", Green]
   };
 
 pos = Flatten[Table[{m, n}, {m, 18}, {n, 2 m - 1}], 1];
 
 tree = Table[RandomChoice[atoms, k], {k, 1, 35, 2}];
 
 snow = Table[
   RotateLeft[ArrayPad[{RandomChoice[atoms[[1 ;; 2]]]}, {0, sz}, " "],
     RandomInteger[sz]], {sz + 1}];
 
 Dynamic[Refresh[
   
   Overlay[{
     
     tree[[Sequence @@ RandomChoice[pos]]] = RandomChoice[atoms];
     Column[Row /@ tree, Alignment -> Center, Background -> Black],
     
     Grid[
      snow = 
       RotateRight[
        RotateLeft[#, 
           RandomChoice[{(1 - p)/2, p, (1 - p)/2} -> {-1, 0, 1}]] & /@
          snow
        , {1, 0}]]
     
     }, Alignment -> Center]
   
   , UpdateInterval -> 0, TrackedSymbols -> {}]
  ]
 ]

enter image description here

Mathematica ASCII

I really like ASCII art, so I add another very different answer - especially so it's so short in Mathematica:

Column[Table[Row[RandomChoice[{"+", ".", "*", "~", "^", "o"}, k]], {k, 1, 35, 2}], 
Alignment -> Center]

enter image description here

Mathematica ASCII

I really like ASCII art, so I add another very different answer - especially so it's so short in Mathematica:

Column[Table[Row[RandomChoice[{"+", ".", "*", "~", "^", "o"}, k]], {k, 1, 35, 2}], 
Alignment -> Center]

enter image description here

And now with a bit more sophistication a scalable dynamic ASCII tree. Watch closely - the tree is also changing - snow sticks to branches then falls ;-)

DynamicModule[{atoms, tree, pos, snow, p = .8, sz = 15},
 
 atoms = {
   Style["+", White],
   Style["*", White],
   Style["o", White],
   Style[".", Green],
   Style["~", Green],
   Style["^", Green],
   Style["^", Green]
   };
 
 pos = Flatten[Table[{m, n}, {m, 18}, {n, 2 m - 1}], 1];
 
 tree = Table[RandomChoice[atoms, k], {k, 1, 35, 2}];
 
 snow = Table[
   RotateLeft[ArrayPad[{RandomChoice[atoms[[1 ;; 2]]]}, {0, sz}, " "],
     RandomInteger[sz]], {sz + 1}];
 
 Dynamic[Refresh[
   
   Overlay[{
     
     tree[[Sequence @@ RandomChoice[pos]]] = RandomChoice[atoms];
     Column[Row /@ tree, Alignment -> Center, Background -> Black],
     
     Grid[
      snow = 
       RotateRight[
        RotateLeft[#, 
           RandomChoice[{(1 - p)/2, p, (1 - p)/2} -> {-1, 0, 1}]] & /@
          snow
        , {1, 0}]]
     
     }, Alignment -> Center]
   
   , UpdateInterval -> 0, TrackedSymbols -> {}]
  ]
 ]

enter image description here

Source Link
Vitaliy Kaurov
  • 1.6k
  • 14
  • 19

Mathematica ASCII

I really like ASCII art, so I add another very different answer - especially so it's so short in Mathematica:

Column[Table[Row[RandomChoice[{"+", ".", "*", "~", "^", "o"}, k]], {k, 1, 35, 2}], 
Alignment -> Center]

enter image description here