UberGenes

From Esolang
Jump to navigation Jump to search
UberGenes
Paradigm(s) imperative
Designed by User:Quintopia
Appeared in 2015
Computational class Turing complete
Reference implementation See below
Influenced by Aubergine
File extension(s) .ug

UberGenes is a mostly backwards-compatible extension to Aubergine created by User:Quintopia in 2015. It was designed with the goals of removing some of the arbitrary restrictions in Aubergine, increasing functionality, and being able to produce a tiny code footprint when Aubergine source code length is summed with the length of the interpreter.

Specification

Start with Aubergine.

Then let every letter of the alphabet be a valid unbounded register, dereferenceable by capitalizing it.

Then let every digit represent its numeric value in second arguments.

Then add all of the following commands /,*,^,|,&,% which integer divide, multiply, xor, or, and, and mod respectively the first argument by the second argument and store the result in the first argument. Also add the commands > and < which set the first argument to 1 if it is greater than or less than respectively the second argument and zero otherwise.

Then remove the restriction on "o", allowing it to be used as an argument anywhere, and the restrictions preventing "o" and "i" from being dereferenced.

Then allow locations beyond the bounds of the initial program to be read (with default value 0) and written with arbitrary values, and allow the instruction pointer to jump out there too. (In Aubergine, jumping beyond the bounds of the program terminates it. In UberGenes, the program ends when the program tries to execute a non-valid command. Just to allow for a bit of golfing, it will also start printing characters from that location forward until it reaches an unprintable one before halting. This is all mostly Aubergine-compatible behavior, although the Aubergine interpreters will give an error instead of printing before halting when reaching an unrecognized instruction.)

Examples

All of the examples from the Aubergine page also work in UberGenes, but the following Hello, World! program only works in UberGenes (it's also a quine):

Hello, World!

Here's a program using UberGenes specific features which inserts a space at the beginning of every line. (Useful for wikifying code.)

=aA=A4*A8+a1=d6*d4=Ao:dA:Ii=b5+b5-bA/d4:db+a1=i0

This one prints the max of two characters:

=ao=bo=ca=db>cb>da*ca*db+cd=oc

This one counts up forever, one decimal number per line:

=ii+a1=l0-l2=pa=z8*z6=t5*t2=Lt=bi=qp%qt+qz-l1=Lq/pt:bp=bi=oL+l1:bL=i0

Read in an integer and say whether it's even or odd:

=A0=b8*b6-bo=c0-cb=d9+d1<dc=fI:fd>ec:fe=Ac=i0
Got ones digit!  Y=gi-g1=gG=G0%A2*A5+iAEven
Odd

Implementations

Python 2

It does all the normal error checking an interpreter should, but weighs in at only 907 bytes (Unix). It can also be safely imported as a module.

exec("eNqtVE2P0zAQvedXWJZK7U0wTVfLR7LmBlouVD3shSikluO2llInazvdrYD/zjjZlnY5IZFDJM943nvz5ejAq0rvutb6qiJTd3BTGtVqjb6Ru0TTTHK5teSOyeKO6VjHaUn1Gp2ftUFWmI0i85u3VDVOreQq76w2Hk8c0g4Jg7TZi0bXCAzCbvqdMh4Jj+RWWCG9suBgeEJkgr0Tre03VoEZFzrL5mUSmNJY0/zA1JP2JB0VbshJnw6iNPpLCsa5Vb63pijwLA8pzWhe4aTAYwb7YuLKEk9WOr6erxI8WGow6LKQnEvWtI/KElrCkWknmm4r4JSMnKOx1hvQRMtBU/cvmnAQlP4PQQM3tIlmEfIc86v49ZvJz1ffs4+3OH/gB+Z83fY+Qo9b3Sh01lJop0EewtBZW+cl52maZssxUhtmlaih7nnQA56St7Ymy5DhEoWk0AwQDD8CpCPABSqYbt4HomBTMA9kQ/4QUpoN2LObkr9wwshRCAs0Q7h6UpJ05+54yqfxRUB8kWJ8yfSswVyRYzoXTaLZA3u02isygoxXhrCTRIDix0N8fazrkfAElyYB8AXes6hQTB3zNJKNcA7dQ26hi7CNRodddIkM7USO7fmPX7kDxhn8YbjAuG7t+Wx9eJek82uawd0CCj2LdAAyYqeqinNcVTuhTVVhwANPoww5MFjEPb2dZ+Oqfm3RGlIIIci3Q417rxiOTnX39pAteNudgou0TLDFNJcXT4hsmwa2V7cGnhIGKYm+gRmSngBPogxsvxVQjJ3oCExR0mjnyWKcMBq+fMFk0zpFhq4/SdV59GXxydrWPov9HIo9nbgpMq2HWvSmhudjfRwSS+6JpPQ3cZh2Dw==".decode('base64').decode('zip'))