A more complex quine

A follow-on from my earlier post about quines.

With just a little bit of spare time…

After my earlier post I thought I might try to make a more complex quine. I decided to make a counting quine; where there is a number in the source code and each time you run the code the number is incremented. For this to be interesting (even to be really noticeable) I formatted the numbers as a 5×7(ish) grid of characters. For example:

  #   ##  ####
 ##  #  #    #
  #    #   ###
  #   #      #
 ### #### ####

(although the line-spacing here makes them harder to read than a text editor or GitHub.)

The first thing I realised as I was exploring with this idea was that Continue reading

Quines

I was recently reminded of the concept of a quine. A quine is a computer program which takes no arguments and whose output is it’s own source code. It’s a neat little idea.

Let’s write

I’d seen some quines but hadn’t studied their solutions. So I though I’d try my hand and see how I would go at writing one. I used my current language-of-choice, Groovy. I’ve put my code, including a shell script to test your quines, up in a Github repo at https://github.com/dnahodil/groovy-quine.

So let’s get started. Create a new Continue reading