Skip to main content
Tweeted twitter.com/StackCodeGolf/status/667560003029569536
fixed minor typo
Source Link
Alex A.
  • 24.8k
  • 5
  • 39
  • 120

Here are the characters your program shuoldshould support with their flipped counterparts:

Here are the characters your program shuold support with their flipped counterparts:

Here are the characters your program should support with their flipped counterparts:

Source Link
Dendrobium
  • 2.5k
  • 13
  • 26

Reverse Boustrophedon Text

Boustrophedon is a type of bi-directional text where successive lines alternate between reading left-to-right and right-to-left. Character direction was also mirrored with respect to reading direction. In reverse boustrophedon writing systems, characters were rotated 180 instead of mirrored.

#Challenge#

Write a program/function that accepts a string of text and a number of columns, and outputs the string formatted into the specified number of columns with alternating lines flipped upside down.

#Input#

Your program should accept two arguments:

  • S, the string of text to format
  • N, the number of columns

#Output#

Your program should output S wrapped in N columns with alternating lines flipped 180 degrees.

  • The reading direction of the first line is always left-to-right.
  • Don't worry about where to place line breaks, lines can be split at any character, no hypenation of words required.
  • You may assume input string will not contain any line breaks.

Here are the characters your program shuold support with their flipped counterparts:

Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ ∀qƆpƎℲפHIſʞ˥WNOԀQɹS┴∩ΛMX⅄Z Lowercase: abcdefghijklmnopqrstuvwxyz ɐqɔpǝɟƃɥᴉɾʞlɯuodbɹsʇnʌʍxʎz Punctuation: &_?!"'., ⅋‾¿¡„,˙' 

#Test Cases#

S: The quick brown fox jumps over the lazy dog. N: 30 Output: The quick brown fox jumps over ˙ƃop ʎzɐl ǝɥʇ 

S: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vel libero arcu. Nunc dictum elementum lectus nec aliquet. Donec dolor nunc, sodales at dolor rhoncus, hendrerit scelerisque purus. Pellentesque vel sagittis libero, et rutrum leo. Nullam vulputate enim et massa dictum, vitae venenatis augue lobortis. Fusce sollicitudin ultrices consequat. Vestibulum quis nunc non tortor eleifend facilisis. In at nunc elit. Aliquam pellentesque, lectus quis aliquam posuere, quam lectus sagittis metus, ut auctor sem quam a neque. Integer rhoncus lobortis nisl. Pellentesque mi dui, laoreet in metus quis, mollis accumsan est. Nunc dignissim tortor ac eleifend tempus. Ut ut tellus aliquam, luctus nulla quis, consectetur nunc. Suspendisse viverra molestie condimentum. Curabitur et hendrerit augue. N: 50 Output: Lorem ipsum dolor sit amet, consectetur adipiscing uǝɯǝlǝ ɯnʇɔᴉp ɔunN ˙nɔɹɐ oɹǝqᴉl lǝʌ ǝnbsᴉnQ ˙ʇᴉlǝ tum lectus nec aliquet. Donec dolor nunc, sodales lǝԀ ˙snɹnd ǝnbsᴉɹǝlǝɔs ʇᴉɹǝɹpuǝɥ 'snɔuoɥɹ ɹolop ʇɐ lentesque vel sagittis libero, et rutrum leo. Null sᴉʇɐuǝuǝʌ ǝɐʇᴉʌ 'ɯnʇɔᴉp ɐssɐɯ ʇǝ ɯᴉuǝ ǝʇɐʇndlnʌ ɯɐ augue lobortis. Fusce sollicitudin ultrices conse ɔɐɟ puǝɟᴉǝlǝ ɹoʇɹoʇ uou ɔunu sᴉnb ɯnlnqᴉʇsǝΛ ˙ʇɐnb ilisis. In at nunc elit. Aliquam pellentesque, lec ʇǝɯ sᴉʇʇᴉƃɐs snʇɔǝl ɯɐnb 'ǝɹǝnsod ɯɐnbᴉlɐ sᴉnb snʇ us, ut auctor sem quam a neque. Integer rhoncus lo snʇǝɯ uᴉ ʇǝǝɹoɐl 'ᴉnp ᴉɯ ǝnbsǝʇuǝllǝԀ ˙lsᴉu sᴉʇɹoq quis, mollis accumsan est. Nunc dignissim tortor u snʇɔnl 'ɯɐnbᴉlɐ snllǝʇ ʇn ʇ∩ ˙sndɯǝʇ puǝɟᴉǝlǝ ɔɐ ulla quis, consectetur nunc. Suspendisse viverra m ˙ǝnƃnɐ ʇᴉɹǝɹpuǝɥ ʇǝ ɹnʇᴉqɐɹnƆ ˙ɯnʇuǝɯᴉpuoɔ ǝᴉʇsǝlo