Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Freyaday on July 05, 2011, 05:00:15 am

Post by: Freyaday on July 05, 2011, 05:00:15 am
Let's start a little game.
Let's see who can come up with the most brain-bending legal line of code in pure Axe that does not crash the calculator.
The winners are those whose code cannot be deciphered by anyone else.
Post by: AngelFish on July 05, 2011, 05:07:36 am
I predict Runer will win this hands down...
Post by: ZippyDee on July 05, 2011, 05:18:10 am
Asm(barrage of hex)
Post by: Freyaday on July 05, 2011, 05:33:24 am
Note: Pure Axe means without the use of Assembly
Post by: ZippyDee on July 05, 2011, 05:34:17 am
AWWWWWWWWWWWW D:
Post by: AngelFish on July 05, 2011, 05:42:12 am
Okay, this compiles and doesn't crash:

{°A}+(X^3°port+9[30]#Realloc(°W){°r1*6,2[23]}+°Θport→{{A}r}
Post by: ZippyDee on July 05, 2011, 05:47:14 am
HOLD UP A SECOND
The winners are those whose code cannot be deciphered by anyone else.
Does this mean that you have to be able to decipher it yourself?
Post by: TIfanx1999 on July 05, 2011, 06:19:12 am
I would think so, yes.
Post by: ZippyDee on July 05, 2011, 06:19:54 am
Yes, it was confirmed: You must be able to decipher your code, because you have to be able to tell people if they are wrong.
Post by: Freyaday on July 05, 2011, 06:20:05 am
It does, that way you can tell us if we get your code's function wrong.
Zippy beat me to it.
Post by: yunhua98 on July 05, 2011, 10:38:01 am
Okay, this compiles and doesn't crash:

{°A}+(X^3°port+9[30]#Realloc(°W){°r1*6,2[23]}+°Θport→{{A}r}
I give up.  :P  I can't even understand most other people's game codes,  much less a messed up code that doesn't do much.  :P
Post by: Ashbad on July 05, 2011, 12:27:59 pm
Okay, this compiles and doesn't crash:

{°A}+(X^3°port+9[30]#Realloc(°W){°r1*6,2[23]}+°Θport→{{A}r}

Stores the bottom 8 bits of A in HL, pushes HL, takes the value of X mod 3 and puts in HL, attempts to find the address of symbol port but resolves to nothing, adds 9, adds \$30 to the .data section of the program, reallocated the standard variables so that A corresponds to W, B corresponds to X, etc., pushes HL, gets the address of the var r1*6, puts 2 in HL, adds \$23 to the .data section of the program, pops HL, adds the address of the var theta, takes the state of the link port and stores to the byte pointed to by the short pointed to by the value of A.  Whew :)

My turn my turn!  :D

({{rand+nib{8/cos(SQRT(rand20)+8erandrand)16BITANDsin(->F)}}->{°Θ}r/{EFFFF xor L1))}16BITXOR{->{°C-4}rr°A+{Trand*85+rand^°C}}r}//{rand+L1}2)**{F} and {5max(,)5}

Edit: I'll admit when I wrote this I had no idea what °port would correspond to.  My theory is that it basically would result to returning nothing, ignore the port and simply preserve HL, or even possibly returning the address of the embedded "port" function added to the .text portion of the program.  With a quick test, I realized this wont even compile just because of those two tokens :P.  So, without that, it's working code -- and I stick by everything else I described in function.
Post by: ZippyDee on July 05, 2011, 02:49:13 pm
Ashbad what does having a comma in {} do? Qwerty's has that....
Post by: Ashbad on July 05, 2011, 03:24:22 pm
It'll basically apply the dereferencing of the { } to the equation on the left hand of the comma into HL, and the expression on the right is subsequently executed like normal.  Therefore, {5,6} basically means {5}:6.  Though, it doesn't seem to always compile :P.  However, when you can get it to do so, that's what it'll represent.

Edit: it'll always compile though if you leave out the ending }, I found.  {5,6: compiles consitantly and works like I described.
Post by: ZippyDee on July 05, 2011, 03:39:22 pm
Interesting.....................................................Good to know!
Post by: Freyaday on July 05, 2011, 04:13:42 pm
Huh. Perhaps Axe is parsing the , as a }
Post by: Quigibo on July 05, 2011, 04:18:12 pm
Fixed the bug, it was simply skipping over it by mistake thinking it was }.

By the way, another syntax obfuscation you can do is that Axe doesn't usually differentiate between } and ) so you can sometimes use them interchangeably.  Sometimes you can't though, especially with r modifiers.  Try this: sin(5}
Post by: Freyaday on July 05, 2011, 10:38:16 pm
Good to hear, Quigibo! The first part is anyway. *.*
sqrt(X2+Y2->{{{ºD-I}r}+sin(5}}
Post by: Broseph Radson on July 05, 2011, 10:43:44 pm
O.O
good lord i dont stand a chance here...
Post by: XVicarious on July 06, 2011, 01:50:19 am
Good to hear, Quigibo! The first part is anyway. *.*
sqrt(X2+Y2->{{{ºD-I}r}+sin(5}}

Taking a wild guess here:
Its taking the square root of X^2+Y^2 and storing it to the position of D-I, plus the sine of 5?
Post by: fb39ca4 on July 06, 2011, 02:02:06 am
Interesting...an obfuscated Axe mini-contest would be cool to see, working similarly to the International Obfuscated C Contest (http://www0.us.ioccc.org/main.html)
Post by: Ashbad on July 06, 2011, 10:50:55 am
Good to hear, Quigibo! The first part is anyway. *.*
sqrt(X2+Y2->{{{ºD-I}r}+sin(5}}

Taking a wild guess here:
Its taking the square root of X^2+Y^2 and storing it to the position of D-I, plus the sine of 5?

Not quite ;)

It's taking the square root of X squared + Y squared and loading it in the byte pointed to by the sine of 5 plus the byte pointed to by the short pointed to by the address of D minus the value of I.  Close :)

No one is gonna try mine? :'(
Post by: Freyaday on July 06, 2011, 01:53:11 pm
All y'all are wrong about mine.
Spoiler For Hint:
Note missing )
Post by: ZippyDee on July 06, 2011, 03:19:17 pm
so it's not valid...
Post by: Freyaday on July 06, 2011, 04:05:24 pm
Oh, it's perfectly valid.
Post by: Ashbad on July 06, 2011, 04:43:09 pm
Oh, it's perfectly valid.

Well then I'm correct :P
Post by: Freyaday on July 06, 2011, 05:27:52 pm
Oh, it's perfectly valid.

Well then I'm correct :P
No. Remember that -> doesn't close all open parentheses in Axe. Remember where Axe closes open parentheses. Remember....
Post by: FinaleTI on July 06, 2011, 05:31:00 pm
Then perhaps it does what Ashbad says, but it square roots everything last instead of first?
Post by: Freyaday on July 06, 2011, 05:31:48 pm
Then perhaps it does what Ashbad says, but it square roots everything last instead of first?
Still no.
Post by: Runer112 on July 06, 2011, 06:23:53 pm
({{rand+nib{8/cos(SQRT(rand20)+8erandrand)16BITANDsin(->F)}}->{°Θ}r/{EFFFF xor L1))}16BITXOR{->{°C-4}rr°A+{Trand*85+rand^°C}}r}//{rand+L1}2)**{F} and {5max(,)5}

This code is not valid Axe code. You have mismatched parentheses:

Depth: 0123        4     5    6      5          4           5   432  3  2 3           210
({{rand+nib{8/cos(SQRT(rand20)+8erandrand)16BITANDsin(->F)}}->{°Θ}r/{EFFFF xor L1))}    continued below...
Depth:          1  2    1     2               10 -1
16BITXOR{->{°C-4}rr°A+{Trand*85+rand^°C}}r}//{rand+L1}2)**{F} and {5max(,)5}

sqrt(X2+Y2->{{{ºD-I}r}+sin(5}}

• Calculate (X2+Y)2, save value for later.
• Load the address of the D variable, and offset this address backwards in memory I bytes.
• Load the byte pointed to by the word above.
• Add to this byte Axe's approximation of 127 times the sine of 5 binary degrees, which is 19.
• Attempt to store the low byte of the previously calculated X2+Y2 to the byte pointed to by the address above. However, in the normal operational mode of the calculator, this address will point to flash so the write will fail.
• Calculate the square root of the value from 2 lines above, giving a final value of 4 to 16.

Alternatively, as one run-on sentence:

Attempt, but fail because flash is read-only, to store the low byte of x squared plus y, squared to the byte pointed to Axe's approximation of 127 times the sine of 5 binary degrees, which is 19, plus the byte pointed to the word pointed to the address of the D variable offset backwards in memory I bytes, and finally take the square root of the address to which x squared plus y, squared was attempted to be stored, giving a final value of 4 to 16.
Post by: Freyaday on July 06, 2011, 06:50:45 pm
Close, but you're forgetting Axe's order of operations
Post by: ztrumpet on July 06, 2011, 06:52:35 pm
Well, it's (X2+Y)2, but I think Runer thought it was so obvious that he didn't mention it. ;)
Post by: Runer112 on July 06, 2011, 06:55:19 pm
Change anywhere I said "x squared plus y squared" to "x squared plus y, squared." The comma is important to include I guess.
Post by: Freyaday on July 06, 2011, 07:19:48 pm
Yes, commas are important.
Post by: JustCause on July 06, 2011, 08:13:21 pm
The hardcore ASM discussions on #omnimaga have been making me feel stupid, but they are NOTHING compared to this. Seriously, what the.../me lies down