Author Topic: [AXE] Little contest :D  (Read 21716 times)

0 Members and 2 Guests are viewing this topic.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [AXE] Little contest :D
« Reply #45 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

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: [AXE] Little contest :D
« Reply #46 on: January 02, 2014, 05:32:58 am »
O_o and what is it ?
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [AXE] Little contest :D
« Reply #47 on: January 02, 2014, 05:33:53 am »
I'll say it when everyone will have his code posted :P

Offline nikitouzz

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 215
  • Rating: +22/-1
    • View Profile
Re: [AXE] Little contest :D
« Reply #48 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
mes records personels :

2x2x2 : 2.18 secondes / 2x2x2 une main : 21.15 secondes / 2x2x2 yeux bandés : 47.59
3x3x3 : 5.97 secondes / 3x3x3 une main : 49.86 secondes
4x4x4 : 1.49 minutes / 4x4x4 une main : 6.50 minutes
5x5x5 : 4.10 minutes / 5x5x5 une main : 18.02 minutes
6x6x6 : 8.10 minutes
7x7x7 : 16.03 minutes
9x9x9 : 58.26 minutes

megaminx : 5.59 minutes / pyraminx : 7.91 secondes / square-one : 1.07 minutes

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: [AXE] Little contest :D
« Reply #49 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).
« Last Edit: January 02, 2014, 05:50:16 am by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: [AXE] Little contest :D
« Reply #50 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.
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: [AXE] Little contest :D
« Reply #51 on: January 02, 2014, 05:59:51 am »
True this, hence the "Maybe" :P
But there is still the problem with the X coordinate.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: [AXE] Little contest :D
« Reply #52 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 )
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [AXE] Little contest :D
« Reply #53 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.

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: [AXE] Little contest :D
« Reply #54 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
« Last Edit: January 02, 2014, 01:52:02 pm by Runer112 »

Offline nikitouzz

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 215
  • Rating: +22/-1
    • View Profile
Re: [AXE] Little contest :D
« Reply #55 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" ?
mes records personels :

2x2x2 : 2.18 secondes / 2x2x2 une main : 21.15 secondes / 2x2x2 yeux bandés : 47.59
3x3x3 : 5.97 secondes / 3x3x3 une main : 49.86 secondes
4x4x4 : 1.49 minutes / 4x4x4 une main : 6.50 minutes
5x5x5 : 4.10 minutes / 5x5x5 une main : 18.02 minutes
6x6x6 : 8.10 minutes
7x7x7 : 16.03 minutes
9x9x9 : 58.26 minutes

megaminx : 5.59 minutes / pyraminx : 7.91 secondes / square-one : 1.07 minutes

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [AXE] Little contest :D
« Reply #56 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.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: [AXE] Little contest :D
« Reply #57 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
« Last Edit: January 02, 2014, 03:31:28 pm by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Runer112

  • Moderator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: [AXE] Little contest :D
« Reply #58 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).
« Last Edit: January 02, 2014, 03:39:47 pm by Runer112 »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [AXE] Little contest :D
« Reply #59 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 )

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!