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 Revisions

6 of 8
added 61 characters in body
mbomb007
  • 23.6k
  • 7
  • 66
  • 143

Hexagony, 91 bytes

Wow, I would never have imagined I could beat Martin’s Hexagony solution. But—who would have thunk it—I got it done. After several days of failure because I neither had the Hexagony colorer nor the EsotericIDE to check my solution. I got several aspects of the specification wrong, so I produced a few wrong "solutions" just using pen and paper and a text editor. Well, finally I overcame my laziness and cloned both repositories, downloaded VisualStudio and compiled them. Wow, what useful tools they are! As you can see, I am far from being someone you’d call a programmer (I mean, come on! I didn’t even have VisualStudio installed, and have pretty much no clue about how to compile a program) ;)

It still took me a while to find a working solution, and it is quite crammed and chaotic, but here it is in all its glory:

Fizzbuzz in a size 6 hexagon:

3}1"$.!$>)}g4_.{$'))\<$\.\.@\}F\$/;z;u;<%<_>_..$>B/<>}))'%<>{>;e"-</_%;\/{}/>.\;.z;i;..>(('

Hexagonal layout:

 3 } 1 " $ .
 ! $ > ) } g 4
 _ . { $ ' ) ) \
 < $ \ . \ . @ \ }
 F \ $ / ; z ; u ; <
 % < _ > _ . . $ > B /
 < > } ) ) ' % < > {
 > ; e " - < / _ %
 ; \ / { } / > .
 \ ; . z ; i ;
 . . > ( ( '

And the beautiful rendition, thanks to Timwi’s Hexagony Colorer:

Colorized Hexagony FizzBuzz solution

So, here is a 110 seconds long GIF animation at 2 fps, showing the program flow during the first 6 numbers 1, 2, Fizz, 4, Buzz, Fizz, the first 220 ticks of the program (click on the image for the full size):

enter image description here

My goodness, thanks to the Natron compositing software the animation of the pointer was still tedious to create, but manageable. Saving 260 images of the memory was less amusing. Unfortunately EsotericIDE can’t do that automatically. Anyways, enjoy the animation!

After all, once you wrap your head around the memory model and the rather counterintuitive wrapping of paths that cross the borders of the hexagon, Hexagony is not that hard to work with. But golfing it can be a pain in the butt. ;)

It was fun!

M L
  • 3.3k
  • 1
  • 20
  • 19

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