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

Commonmark migration
Source Link

#Mathematica, 131 bytes

Mathematica, 131 bytes

##Tests:

Tests:

#Mathematica, 131 bytes

##Tests:

Mathematica, 131 bytes

Tests:

Source Link
hYPotenuser
  • 783
  • 4
  • 10

#Mathematica, 131 bytes

i=[input string];c=Characters@i;l=Length@c;StringJoin@Riffle[StringJoin@@@SparseArray[Table[{7-Round[6 Sin[.13(x-1)]],x},{x,l}]->c,{13,l}," "],"\n"]

That's 131 characters, including the three for i=foo;. That seemed a reasonable way to take the input; I could have put it straight into the definition of c and saved a few strokes, but that feels unfair.

It's pretty straightforward -- almost even readable. It splits the string into a list of characters, and then puts those characters into a sparse array at the positions determined from the Table (any spot in the array not given a character defaults to a space). The lines are assembled separately, then newlines sprinkled between them. The final StringJoin stitches it all up.

NB: Like some other solutions, this may not actually be valid because it produces a real sinusoid rather than the (beautiful) handcrafted example.

##Tests:

(*i=Programming Puzzles...*)
 ng Puzz on and iasts tration 
 mi le sti a us and is r 
 am s e ns th c eg eq 
 r & qu we en o r u 
 og C r d o ir 
 r o a e e n e 
P d s si l g d 
 e i t zz o , .
 G e u lf ee 
 o ge f p e r 
 lf an or g rs f 
 St ch p min . 0% 
 ack Ex rogram It's 10 
(*i=.... ...*)
 ....... 
 .. .. 
 .. .. 
 . . 
 .. .. 
 . . 
. . .
 .. . 
 . . 
 . .. 
 .. .. 
 ... .. 
 ...... 
(*i= Short text.*)
 t.
 ex 
 t 
 t 
 or 
 h 
S 
 
 
 
 
 
(*i=The quick...*) 
 brown 
 ck fo 
 ui x 
 q j 
 e um 
 h p 
T s 
 o 
 v 
 e 
 r g
 the do 
 lazy 

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