It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
high rated
TLDR:
New and improved GOG.com brainfuck globe quine
https://www.youtube.com/watch?v=ob2zLvE23Lo
Code:
http://www.zbalbous.com/bfgogquine.html
http://www.zbalbous.com/bfgogquine.b

A quine is a computer program that prints out itself. This one is written in brainfuck and it does print itself, except that the globe part of it gets rotated by 1/50th of a cycle. After 50 iterations you get the original code back. In essence, every frame of the video is valid brainfuck code that outputs the next frame.

The long version:
Almost a year ago I created a brainfuck quine that besides printing itself also formed a globe with GOG.com logo that would get rotated with each iteration.

Unfortunately that final product was way too long. A year later, I've finally finished my new and improved version. The new code is much smaller than the old one. If we include the globe, it's about 64% of the old one's size. It's also "better" in the sense that less stuff is hard coded, though as a result it needs a bit more tape memory.

This is much closer to what I envisioned when I started this project. The globe is actually in a prominent place and occupies a large part of the code, rather than being a small circle somewhere at the bottom.
You can compare the results for yourself.
Old version: https://www.youtube.com/watch?v=ws-bRLdMJrs
New version: https://www.youtube.com/watch?v=ob2zLvE23Lo

I realize that after all this work it's still just a globe, just like the old version, but reducing the size of the code did take some work. I'm happy it's done.

Oh, and the new version also contains only one single period "." neatly hidden in my email.

For the time being this is going to be the final version. I don't have any ideas on how to meaningfully improve it at the moment.

If you want to run the code, note that:
_It uses 8-bit size cells, which is the usual implementation.
_You need a memomry size of 175,000 (!). 174,116 to be exact. Note that most brainfuck implementations use a default of 30,000 memory size, so make sure change that, else the code won't run properly.
_It's very slow.

You can try running the code in this online interpreter
https://copy.sh/brainfuck/
Remember to change memory size to 175000 first. Or use Dynamic memory but that will make it even slower. It runs about 3 minutes on my machine. Other online interpreters out there might not even run it. A better idea would be to look for faster interpreters, just remember about the memory. I used one writtern in C# that works by translating the brainfuck commands to their C equivalents.

Also, you will need a monospace font of course to see the output properly. Depending on what font you use the globe might be a bit stretched. I used Lucida console in the video.

Credits:
_A huge huge thank you to Yusuke Endoh's Qlobe for the idea and inspiration. Unfortunately I do not know Ruby, but his quine convinced me to try copy his idea in brainfuck.
http://mamememo.blogspot.ie/2010/09/qlobe.html
_Thanks to Erik Bosman's famous 410-byte quine.

EDIT (09/06/2018):
Full code with comments is now available
https://www.gog.com/forum/general/my_new_and_improved_gogcom_brainfck_quine_v2/post15
https://www.dropbox.com/s/ye3ufzb286yvyt6/GOG%20globe%20quine%20with%20notes.zip?dl=0
Post edited June 09, 2018 by ZFR
deleted
low rated
avatar
ZFR:
How about next time Hero,call it braindead?
Very impressive, as ever ZFR :)

I still have no idea how you manage to do stuff like that...
I'm impressed.
I don't understand a single word, but I'm still impressed.
HOW

HOW

can you also factor products of large primes in your mind by firing neural impulses through hyperspace

seriously how
avatar
Tauto: How about next time Hero,call it braindead?
Why? That is the name of the programming language he used, why change its name?
low rated
avatar
Tauto: How about next time Hero,call it braindead?
avatar
JMich: Why? That is the name of the programming language he used, why change its name?
You just sit back and think about it for a while,maybe the penny will drop.
Post edited June 29, 2017 by Tauto
Thanks everyone :)

And I just realized that I missed my chance of having this done on W.V. Quine's birthday, the 25th of June. And I did have time, I was just lazy this weekend. Pity I didn't see it before, would have been pretty cool.
avatar
Starmaker: HOW

HOW

can you also factor products of large primes in your mind by firing neural impulses through hyperspace

seriously how
If anyone is really interested in how this works I've included the full source code. You can check it here:
http://www.zbalbous.com/bfgogquine.html
It's pretty straightforward.
Post edited June 29, 2017 by ZFR
avatar
ZFR: Thanks everyone :)

And I just realized that I missed my chance of having this done on W.V. Quine's birthday, the 25th of June. And I did have time, I was just lazy this weekend. Pity I didn't see it before, would have been pretty cool.
avatar
Starmaker: HOW

HOW

can you also factor products of large primes in your mind by firing neural impulses through hyperspace

seriously how
avatar
ZFR: If anyone is really interested in how this works I've included the full source code. You can check it here:
http://www.zbalbous.com/bfgogquine.html
It's pretty straightforward.
I mean, how do you even go about inventing one? Brainfuck is already aptly named, quines make conventional algebra fail there and then, but a SPINNING GLOBE is just out of this world. It's something I expect to see in God's cubicle in a good cyberpunk novel: the proof of Erdos-Gyarfas on a post-it note, a computer running a polynomial sat solver, and a spinning globe brainfuck quine.
Well done, thanks to your earlier threads that featured b***nfuck, I have a very rough idea about how the code works. Very interesting.
haha! That is (brain)freaking awesome!
avatar
chevkoch: b***nfuck
This is perfect.
Congrats for your.. strange accomplishment :P
That language is really convenient to use (+_+)
Sorry to bump this after a year. I thought earlier that I'll work on this a bit more, but at the moment, and in the foreseeable I don't see myself improving this any further.

Which is why I thought I'll publish my quine code with my original notes and comments, in case anyone is interested. So if you want to know how the code works in more detail, download this:
https://www.dropbox.com/s/ye3ufzb286yvyt6/GOG%20globe%20quine%20with%20notes.zip?dl=1

Just to note:
I'm really messy when it comes to comments in code. And looking at it now, I can't remember what half the stuff is for. If anyone is geuninely interested I could try going through it to see if I figure out more, but only if someone is really interested and puts the effort too.

From what I remember offhand:

Words like "2minus" or "minus4" refer to the values -2 (254), -4 (252)... etc. The reason I didn't put the minus sign '-' but instead spelled out 'minus' was so that the comment doesn't interfere with code, since - is a valid brainfuck character. These are generally used as different markers to mark locations on the brainfuck tape, so the pointer can get quickly to these points.

The encoding used in the data section is in the form (x, y), where each character is encoded such that its ASCII value is equal to 16y+x+43. e.g. 'a' with an ASCII value of 97 would be encoded as (6, 3) becauaw 3*16+6+43=97. x and y are adjacent cells on brainfuck tape.
Why such a particular encoding? Because using this particular encoding guarantees that brainfuck characters can be encoded with minimal values:
+ 0 0
- 2 0
> 3 1
< 1 1
[ 0 3
] 2 3
. 3 0
(The + sign in particular is very common and can be encoded with (0,0)).
This makes the DATA section much smaller.
This method, as far as I'm aware, was first used by Erik Bosman in his 410byte quine, which at that time was the shortest brainfuck quine. I've included Erik Bosman's original quine with his excellent comments (to say they are clearer than mine would be a huge understatement). It was my starting point.

The world image is stored by storing consecutive - and + values. e.g. ---+++++-++ would be stored as (3,5,1,2). New lines are separated by -2 (254). I've included the world image that I used.

When I have the time I'll look through my files to see if I can find my incremental files to publish them as well. They should make this hopefully much more clearer.
Post edited June 10, 2018 by ZFR