Omnimaga

Calculator Community => Other Calculators => Topic started by: nikitouzz on December 27, 2013, 11:02:15 am

Title: [AXE] Little contest :D
Post by: nikitouzz on December 27, 2013, 11:02:15 am
Hey guys, i propose a little contest that i've started with matref and hayleia in axe !

rules :
-make on programme who represent a sprite 8x8 who scrool smoothly with the keys 1/2/3/4 (axe keys)
-the programme need to be the more smaller on size !
-WARNING : ASM() IS BANNED YOU CAN't USE THIS COMMAND
-the programme need to be in axe pur.
-the sprite need stocked as this : [XXXXXXXXXXXXXXXX]→PIC0

EXAMPLES :

i've make the programme and i have 336Byte ;) try to make better !  EDIT : For the moment I have 324Byte !!! ;) ;) ;)

(http://i.imgur.com/5OVkFpG.gif)

Good luck ! ;)






So the Winner his (before verification...)
1)RUNER112 !!!

code :

Code: [Select]
.S

ᴇ847A→°SX
ᴇ8481→°SY

FnOff

While 1
DispGraphClrDraw
(Select((getKey(3)+SX+1-getKey(2)??96)-97,PutSprite())?+96)PutSprite()
getKey(1)-getKey(4)+SY→SY
EndIf getKey(15)

Lbl PutSprite
→SX
64
While 1
If pxl-Test(-1→r₁, and 0,[AA55AA55AA55AA55])
Pxl-On(r₁ and 7+SX,r₁*32/256+SY and 63)
End
End!If r₁
Return

2)nikitouzz !!!

code :

Code: [Select]
:.A
:While 1
: For(64)r
: If Pxl-Test(→r1,0,[AA55AA55AA55AA55])
: Pxl-On(r1 and 7A(),r1/2/2/2+B and 63)
: End
: r1+1
:End
:getKey(1)-getKey(4)+B→B
:getKey(3)-getKey(2)A()→A
:DispGraphClrDraw
:EndIf getKey(15)
: Lbl A
:+A+96
:While →C≥96
: C-96
:End
:C
3)themachine02 !!!

code :

Code: [Select]
[AA55AA55AA55AA55]→pic0

While 1

    For(8)^r
      →r1
      pic0
         For(8)^r
            If {→r2}er1
               pxl-on(r1+X^96,Y+r2 and 63)
            End
            r2+1
         End
      r1+1
     End

getKey(1)-getKey(4)+Y→Y
getKey(3)-getKey(2)+X→X

DispGraphClrDraw
EndIf getKey(15)


Themachine make 324 and me 325 but themachine code bug when X arrive to 65535 !
Title: Re: [AXE] Little contest :D
Post by: Hayleia on December 27, 2013, 11:05:54 am
with matref
???

Anyways, mine is faster but 364 bytes large -.-°
Title: Re: [AXE] Little contest :D
Post by: nikitouzz on December 27, 2013, 11:06:24 am
Oh sorry this is with matref and hayleia i correct ! :)
Title: Re: [AXE] Little contest :D
Post by: Lunar Fire on December 27, 2013, 01:31:41 pm
Would love to try this one out, but I have never used Axe before. Could someone point me to a good starting place?
Title: Re: [AXE] Little contest :D
Post by: Matrefeytontias on December 27, 2013, 03:48:46 pm
The PDF file included in Axe.zip I guess. I don't know of any other English actual Axe tutorial.

I'll work on my version a little more.
Title: Re: [AXE] Little contest :D
Post by: JWinslow23 on December 27, 2013, 03:51:24 pm
nikki, I will try!

EDIT: Can someone share their source? Because I don't even have screen wrapping and I already have 400 bytes.
:(
Title: Re: [AXE] Little contest :D
Post by: Matrefeytontias on December 27, 2013, 04:15:36 pm
You don't share sources in a contest :P
Title: Re: [AXE] Little contest :D
Post by: JWinslow23 on December 27, 2013, 04:43:42 pm
Then I give up. :\
Title: Re: [AXE] Little contest :D
Post by: ClrDraw on December 27, 2013, 04:48:04 pm
Quote
Would love to try this one out, but I have never used Axe before. Could someone point me to a good starting place?

If you're familiar with basic then take a look here (http://axe.eeems.ca/Commands.html#systemCommands).
Title: Re: [AXE] Little contest :D
Post by: Runer112 on December 27, 2013, 08:41:04 pm
Wow, that's pretty impressively optimized, nikitouzz. I tried my best at it and with many evil tricks managed to beat your record, but only barely, with 333 bytes. Not going to post any code yet of course, I want to give others a chance. Also, I'm not sure I'm done optimizing it yet. ;)
Title: Re: [AXE] Little contest :D
Post by: nikitouzz on December 28, 2013, 08:18:53 am
I'am at 334Byte for the moment !!!!! :)
Title: Re: [AXE] Little contest :D
Post by: Matrefeytontias on December 28, 2013, 08:51:39 am
I'm stuck at 337 -.- (VAT header included, 329 without it).
Title: Re: [AXE] Little contest :D
Post by: TheMachine02 on December 28, 2013, 09:02:01 am
326  :P

Title: Re: [AXE] Little contest :D
Post by: ordelore on December 28, 2013, 11:31:45 am
I'm game, lets see what I can do.
Title: Re: [AXE] Little contest :D
Post by: ClrDraw on December 28, 2013, 12:30:24 pm
I got to about 320 without scrolling but when I add it I bet it will be way more...
Title: Re: [AXE] Little contest :D
Post by: nikitouzz on December 28, 2013, 12:45:35 pm
330 Byte !!!!!!!!!!!!!!!!!!!!! hahah themachine :p

Noted that i have never "^" token in my programme :p
Title: Re: [AXE] Little contest :D
Post by: TheMachine02 on December 28, 2013, 12:48:19 pm
niki you know that 330>326 right ? cause you scary me  :P
Title: Re: [AXE] Little contest :D
Post by: nikitouzz on December 28, 2013, 01:24:23 pm
I have 327 now !!!!! :p
Title: Re: [AXE] Little contest :D
Post by: ClrDraw on December 28, 2013, 01:29:20 pm
This looks a lot like my game Blox.

(http://img.ourl.ca//blox-1.gif) Only 2431 bytes  ;)
Title: Re: [AXE] Little contest :D
Post by: nikitouzz on December 28, 2013, 01:32:05 pm
:p
for the moment i have 324 Byte and the mchine have same thing off me :)
Title: Re: [AXE] Little contest :D
Post by: Runer112 on December 28, 2013, 02:09:24 pm
No matter how much I struggle, I can't seem to get it lower than about 333 bytes. Unless I think of something huge, you guys may beat me at my own language. :P
Title: Re: [AXE] Little contest :D
Post by: nikitouzz on December 28, 2013, 02:12:05 pm
XD and i think that i cam make lower than 324 Byte :p
Title: Re: [AXE] Little contest :D
Post by: Matrefeytontias on December 28, 2013, 02:12:12 pm
/me wantz source afterwards
Title: Re: [AXE] Little contest :D
Post by: nikitouzz on December 28, 2013, 02:13:37 pm
hahaha XD the winner post his source yes ! ;) btu the contest finished wensday ! ;)
Title: Re: [AXE] Little contest :D
Post by: ClrDraw on December 28, 2013, 02:33:50 pm
I'm at 427... This is KILLING me  :w00t:
Title: Re: [AXE] Little contest :D
Post by: Runer112 on December 28, 2013, 05:56:45 pm
I've had a breakthrough! Don't count your winnings yet, nikitouzz. :P
Title: Re: [AXE] Little contest :D
Post by: nikitouzz on December 28, 2013, 05:59:40 pm
Hhéhé i wait, i wait :p

But seriously, themachine's code is better than me (he dont show all the code by partialy) i can optimise his code who make 324B !
Title: Re: [AXE] Little contest :D
Post by: TheMachine02 on December 29, 2013, 07:37:59 am
yeah  :P I'm at 324 but I can't get it lower, even though I sense there still optimizations...
Title: Re: [AXE] Little contest :D
Post by: ben_g on December 30, 2013, 08:08:36 am
Is axe fusion allowed? If so, I've got 264 bytes. Otherwise, I have 416 bytes and have to find an other way of doing this.

BTW: Does ^64 compile to " and %0000000000111111" ? (and being the 16-bit and instruction (plot style dot),and % being the pi character) Both have the same size when compiled.
Title: Re: [AXE] Little contest :D
Post by: MGOS on December 30, 2013, 08:29:49 am
Is axe fusion allowed? If so, I've got 264 bytes. Otherwise, I have 416 bytes and have to find an other way of doing this.

BTW: Does ^64 compile to " and %0000000000111111" ? (and being the 16-bit and instruction (plot style dot),and % being the pi character) Both have the same size when compiled.
I think axe fusion isn't allowed, that's cheating - or you add the Axe app to your program size ;)

x^2n compiles to x . (n-1) to x . 2n-1 AutoOpts (http://axe.eeems.ca/Auto%20Opts.txt) is a really useful reference for the size of each instruction.

Edit: fixed that math
Title: Re: [AXE] Little contest :D
Post by: TheCoder1998 on December 30, 2013, 08:43:25 am
i know this isn't the right place to ask this, but what exactly is axe fusion?
Title: Re: [AXE] Little contest :D
Post by: Matrefeytontias on December 30, 2013, 09:01:59 am
It's a compiling mode useful for reducing the size of your test programs. Instead of being included in the final program, Axe functions are directly executed in the Axe app.
Title: Re: [AXE] Little contest :D
Post by: Hayleia on December 30, 2013, 09:02:06 am
x^2n compiles to x . (n-1)
Did you mean x . 2n-1 ?

i know this isn't the right place to ask this, but what exactly is axe fusion?
When you compile an Axe program, you can compile as a Noshell program, or as a Ion one or a MirageOS one, an app, and you also have the fusion option. Basically, they are a bit faster to compile and smaller because they don't include any routine, they kind of use Axe as a shell and use the routines from the app instead of including them directly. This is why MGOS said "or you add the Axe app to your program size".

edit ninja'd
Title: Re: [AXE] Little contest :D
Post by: MGOS on December 30, 2013, 09:06:52 am
Did you mean x . 2n-1 ?
No, I meant x . 2n-1 ;)
Title: Re: [AXE] Little contest :D
Post by: Hayleia on December 30, 2013, 09:08:11 am
Did you mean x . 2n-1 ?
No, I meant x . 2n-1 ;)
Lol, we kept failing :P
Anyway, the right answer is written now.

editAlso, an Axe nazi would tell us "nope, you meant  x . (2n-1)"
Title: Re: [AXE] Little contest :D
Post by: Matrefeytontias on December 30, 2013, 09:16:44 am
Nope, you meant x . (2n-1).
/me runs

When you compile an Axe program, you can compile as a Noshell program, or as a Ion one or a MirageOS one, an app, and you also have the fusion option.
And DoorsCS7.
Title: Re: [AXE] Little contest :D
Post by: Hayleia on December 30, 2013, 09:40:17 am
When you compile an Axe program, you can compile as a Noshell program, or as a Ion one or a MirageOS one, an app, and you also have the fusion option.
And DoorsCS7.
I knew I forgot one. And I was too lazy to check :P
Title: Re: [AXE] Little contest :D
Post by: nikitouzz on December 30, 2013, 10:52:37 am
241 with axe fusion :p but no isn't alloweb you compile in noshell !
Title: Re: [AXE] Little contest :D
Post by: Runer112 on December 30, 2013, 12:06:37 pm
Just going to pop in and say that the Auto Opts.txt file shouldn't be used any more. You may actually notice that the Auto Opts.txt file wasn't included in the Axe 1.2.2 release, and this was intentional, as its information has been absorbed by the Commands.html file. If you open Commands.html, select one of the "Show size and speed for:" options in the footer, and hover your mouse over the size or speed information box for just about any math operation; it will provide exact information for any possible input, including all the inputs that were in Auto Opts.txt.

Also: nikitouzz, TheMachine02, if you guys are still at 324 bytes, I currently have you beat. ;)
Title: Re: [AXE] Little contest :D
Post by: nikitouzz on December 30, 2013, 03:41:43 pm
I have 318 with a little bug.... but as i have say, the "contest" will finish wensday !
Title: Re: [AXE] Little contest :D
Post by: Runer112 on December 30, 2013, 05:18:27 pm
I'm only beating you by a single byte, nikitouzz. This should be a close finish!
Title: Re: [AXE] Little contest :D
Post by: nikitouzz on December 30, 2013, 05:23:45 pm
I have already a little bug... but i want beat you :p
Title: Re: [AXE] Little contest :D
Post by: TheMachine02 on January 01, 2014, 10:36:57 am
seem that no matter what I do, can't get it lower than 324 bytes  :P . Oh but wednesday is today isn't it ?  :w00t:
Title: Re: [AXE] Little contest :D
Post by: nikitouzz on January 01, 2014, 06:43:59 pm
Ok so i'm at 325 with the bug correction.....

I resume :
1) Runer112 !
2)Themachine02
3)nikitouzz

For this 3 participant can you share you re source code to verifie it  ! ;)

My code :

Code: [Select]
:.A
:While 1
: For(64)r
: If Pxl-Test(→r1,0,[AA55AA55AA55AA55])
: Pxl-On(r1 and 7A(),r1/2/2/2+B and 63)
: End
: r1+1
:End
:getKey(1)-getKey(4)+B→B
:getKey(3)-getKey(2)A()→A
:DispGraphClrDraw
:EndIf getKey(15)
: Lbl A
:+A+96
:While →C≥96
: C-96
:End
:C
Title: Re: [AXE] Little contest :D
Post by: TheMachine02 on January 02, 2014, 05:17:52 am
here is mine :

Code: [Select]
[AA55AA55AA55AA55]→pic0

While 1

    For(8)^r
      →r1
      pic0
         For(8)^r
            If {→r2}er1
               pxl-on(r1+X^96,Y+r2 and 63)
            End
            r2+1
         End
      r1+1
     End

getKey(1)-getKey(4)+Y→Y
getKey(3)-getKey(2)+X→X

DispGraphClrDraw
EndIf getKey(15)


316 compiled, 324 with VAT
Title: Re: [AXE] Little contest :D
Post by: Matrefeytontias on January 02, 2014, 05:31:53 am
It's scary to notice that although I couldn't get down 329 compiled, I see an optimization in both of your codes :P
Title: Re: [AXE] Little contest :D
Post by: TheMachine02 on January 02, 2014, 05:32:58 am
O_o and what is it ?
Title: Re: [AXE] Little contest :D
Post by: Matrefeytontias on January 02, 2014, 05:33:53 am
I'll say it when everyone will have his code posted :P
Title: Re: [AXE] Little contest :D
Post by: nikitouzz on January 02, 2014, 05:35:39 am
Then the machine you code is false :p if the coordinate arrive to 65565, the sprite make 63 with your calculs :p
Title: Re: [AXE] Little contest :D
Post by: Hayleia on January 02, 2014, 05:48:21 am
It would be hard for a variable to get to 65565, but yeah, I get what you mean, if X increases too much, then it will come back to 0 at an unexpected time (due to 65536 not being a multiple of 96) and the sprite will jump.
Maybe there is also a problem when Y>255, then Y+r2>255 and Y+r2 and 63>255 (and only affects the lower byte).
Title: Re: [AXE] Little contest :D
Post by: TheMachine02 on January 02, 2014, 05:55:26 am
actually, Y+r2 and 63 is correct, cause the pxl-on routine do a ^256 on the Y coordinate.
Title: Re: [AXE] Little contest :D
Post by: Hayleia on January 02, 2014, 05:59:51 am
True this, hence the "Maybe" :P
But there is still the problem with the X coordinate.
Title: Re: [AXE] Little contest :D
Post by: TheMachine02 on January 02, 2014, 06:01:30 am
yep  <_< . So classement change, and I am out (lol I always knew that I am not really good at optimize code for size  :P )
Title: Re: [AXE] Little contest :D
Post by: Matrefeytontias on January 02, 2014, 06:58:07 am
It would be hard for a variable to get to 65565, but yeah, I get what you mean, if X increases too much, then it will come back to 0 at an unexpected time (due to 65536 not being a multiple of 96) and the sprite will jump.
Maybe there is also a problem when Y>255, then Y+r2>255 and Y+r2 and 63>255 (and only affects the lower byte).
Simpler, if one tries to set -1 to X. It becomes 65535.
Title: Re: [AXE] Little contest :D
Post by: Runer112 on January 02, 2014, 01:50:22 pm
Oops, forgot this thing was ending! Anyways I guess here's my prize code, coming in at 317 bytes in the memory management menu (309 bytes in Axe compile screen). You could argue that there is one slight glitch, in that the very first frame displayed is whatever was in the main buffer before the program started, but I see that everyone else cut that corner too so nobody got an unfair gain from it. :P

The source is in the code box below and attached.

Code: [Select]
.S

ᴇ847A→°SX
ᴇ8481→°SY

FnOff

While 1
DispGraphClrDraw
(Select((getKey(3)+SX+1-getKey(2)??96)-97,PutSprite())?+96)PutSprite()
getKey(1)-getKey(4)+SY→SY
EndIf getKey(15)

Lbl PutSprite
→SX
64
While 1
If pxl-Test(-1→r₁, and 0,[AA55AA55AA55AA55])
Pxl-On(r₁ and 7+SX,r₁*32/256+SY and 63)
End
End!If r₁
Return
Title: Re: [AXE] Little contest :D
Post by: nikitouzz on January 02, 2014, 03:17:05 pm
Heu.... /256 can be optimised to /2/2/2/2/2/2/2/2 no ? and why and 0" ?
Title: Re: [AXE] Little contest :D
Post by: Matrefeytontias on January 02, 2014, 03:28:23 pm
/256 is 3 bytes (6C2600) and /2 is 4 bytes (CB3CCB1D if I remember correctly). Do the calculation yourself. And 0 is like /256*256.
Title: Re: [AXE] Little contest :D
Post by: Hayleia on January 02, 2014, 03:29:15 pm
Heu.... /256 can be optimised to /2/2/2/2/2/2/2/2 no ?
No because /256 is just reading the lower byte.

and why and 0" ?
Because that returns 0 in less space than loading 0 when the highest byte of hl is already at 0 (or when we don't care about it).

edit ninja'd
Title: Re: [AXE] Little contest :D
Post by: Runer112 on January 02, 2014, 03:30:13 pm
/2 is 4 bytes, so dividing by 8 with /2/2/2 would be 4+4+4=12 bytes, whereas *32/256 is 5+3=8 bytes (of course this only works if you can afford to lose the top 5 bits with *32). Dividing by 256 with /2/2/2/2/2/2/2/2 would be pretty wasteful, 4*8=32 bytes versus /256, which is only 3 bytes.

The and 0 is effectively just 0, but one byte smaller because it doesn't set the high byte. I used it because the pixel operations throw out the high byte of coordinates anyways (and as Hayleia pointed out, even if the high byte was used, it would already be 0 because r1 is between 0 and 63).
Title: Re: [AXE] Little contest :D
Post by: Sorunome on January 04, 2014, 12:08:51 pm
nuuuu, i missed a fun little contest :P

Anyways, looking nice guys (don't think i'd be able to make it that optimized x.x )