Author Topic: GAME: Optimize this! (83+BASIC)  (Read 11677 times)

0 Members and 1 Guest are viewing this topic.

Weregoose

  • Guest
GAME: Optimize this! (83+BASIC)
« Reply #60 on: September 10, 2007, 12:21:00 pm »
Update:
c1-->
CODE
ec1:L5(1
:2+{Ans,Ans<3,Ans=5,Ans=4,Ans=3,9}-{2,Ans=3,not(fPart(.5Ans)),Ans=5,Ans=1,0→L5
:seq(Ans(X),X,2,5→L2 -or- ΔList(cumSum(Ans→L2:4→dim(L2c2
ec2
Another 10 bytes taken from there.

Delnar_Ersike

  • Guest
GAME: Optimize this! (83+BASIC)
« Reply #61 on: September 10, 2007, 12:43:00 pm »
O_Oshocked2.gif:bow:worship.gif

Well, I implemented all of the stuff I understood in Weregoose's post (aka everything, even if I don't use seq( and sub( ), and it turns out he optimized almost 100 Bytes off. The only thing I didn't implement was the rand(Z thing, because Weregoose probably didn't know what Z means (it is one of the most important variables, alongside Theta): in my program, Z represents the calculator model the program is running on so that the program doesn't go too fast or too slow during the "smooth" transitions. Z is determined towards the beginning of the first program that should be run.

Now that the obvious winner has been announced *cough*Weregoose*cough*, how about if I post the ugliest piece of code in Space Trader? It is kind of short, yet I am positive some of you will notice optimizations.

Weregoose

  • Guest
GAME: Optimize this! (83+BASIC)
« Reply #62 on: September 10, 2007, 01:04:00 pm »
I think I'll only have more to say if I come up with something astronomical.

Looking forward to the next snippet. ;)wink.gif

(Congrats on 2^9 8

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
GAME: Optimize this! (83+BASIC)
« Reply #63 on: September 10, 2007, 01:19:00 pm »
congrats ^.^

Offline Radical Pi

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1143
  • Rating: +5/-2
    • View Profile
    • RealityRevolution
GAME: Optimize this! (83+BASIC)
« Reply #64 on: September 10, 2007, 01:57:00 pm »
Weregoose, how do you do that?! You are amazing...

Can anyone find a more elegant/smaller way to write:
c1-->
CODE
ec14+6fPart(A/3)+6not(fPart(A/3))c2
ec2
Those ending parentheses are there because this little slice of code is one of the coordinates in a text output.
I'm just trying to figure out a way to turn the numbers seq(X,X,1,9) into {6,8,10,6,8,10,6,8,10}. I'm pretty sure my way isn't the best...
One of these days I'll get a sig I'm really proud of.

Weregoose

  • Guest
GAME: Optimize this! (83+BASIC)
« Reply #65 on: September 10, 2007, 03:28:00 pm »
6+6fPart(A/3-3‾

Delnar_Ersike

  • Guest
GAME: Optimize this! (83+BASIC)
« Reply #66 on: September 10, 2007, 04:58:00 pm »
Alright guys, cringe at the most horrible piece of code there is so far in Space Trader (FYI, it's the huge line):
c1-->
CODE
ec1:real(0,0
:real(3,8,0,1
:DelVar W54→B
:Lbl A
:Repeat W≥7
:If B>48
:Then
:For(C,62,55,-1
:real(1,8,C,10,8,5,0,8W,0,0,1
:real(3,8,2,1
:For(D,0,Z
:End:End:End
:While Ans>53 or Ans<49
:real(8
:End
:Ans→B
:If W=2
:(B≠51)(55-B→E
:not(W)(2(B=53)+3(B=52)+4(B=50)+7(B=51))+(W=2)(1+15(B=51))+(B≠49)((W=1)(4E+53-B)+(W=3)(7-B-14(B<52))+(W=4)(72-B)+(W=5)(75-B)+(W=6)(78-B→D[/b]
:If D<7
:Then
:real(12,0,9,55,85,55,1
:For(C,57,62
:real(12,1,8,C-1,86,C-1,1
:real(1,8,C,10,8,5,0,8W,0,0,1
:real(3,8,2,1
:For(F,0,Z
:End:End:Endc2
ec2

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
GAME: Optimize this! (83+BASIC)
« Reply #67 on: September 11, 2007, 02:08:00 am »
Could you state what that line is trying to accomplish, in words? I don't feel like figuring it out myself. :Ptongue.gif
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Weregoose

  • Guest
GAME: Optimize this! (83+BASIC)
« Reply #68 on: September 11, 2007, 09:15:00 am »
All that is equivalent to:
c1-->
CODE
ec1If W=2
(B≠51)(55-B→E
If W=0
2(B=53)+3(B=52)+4(B=50)+7(B=51→D
If W=2
1+15(B=51→D
If B≠49
Then
If W=1
4E+53-B→D
If W=3
7-B-14(B<52→D
If W=4
72-B→D
If W=5
75-B→D
If W=6
78-B→D
Endc2
ec2

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
GAME: Optimize this! (83+BASIC)
« Reply #69 on: September 11, 2007, 05:47:00 pm »
O_Oshocked2.gif

Weregoose

  • Guest
GAME: Optimize this! (83+BASIC)
« Reply #70 on: September 11, 2007, 06:09:00 pm »
...if it helps. I didn't optimize anything.

(All that = that one line)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
GAME: Optimize this! (83+BASIC)
« Reply #71 on: September 11, 2007, 06:25:00 pm »
uhm i dont understand what you mean, i felt it was kinda optimised because of the size decrease

Weregoose

  • Guest
GAME: Optimize this! (83+BASIC)
« Reply #72 on: September 11, 2007, 09:09:00 pm »
c1-->
CODE
ec1:not(W)(2(B=53)+3(B=52)+4(B=50)+7(B=51))+(W=2)(1+15(B=51))+(B≠49)((W=1)(4E+53-B)+(W=3)(7-B-14(B<52))+(W=4)(72-B)+(W=5)(75-B)+(W=6)(78-B→Dc2
ec2
=
c1
-->
CODE
ec1:If W=2
:(B≠51)(55-B→E
:If W=0
:2(B=53)+3(B=52)+4(B=50)+7(B=51→D
:If W=2
:1+15(B=51→D
:If B≠49
:Then
:If W=1
:4E+53-B→D
:If W=3
:7-B-14(B<52→D
:If W=4
:72-B→D
:If W=5
:75-B→D
:If W=6
:78-B→D
:Endc2
ec2

Offline nitacku

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 300
  • Rating: +30/-1
  • ni-ta-ku ^_^
    • View Profile
GAME: Optimize this! (83+BASIC)
« Reply #73 on: September 11, 2007, 11:32:00 pm »
c1-->
CODE
ec1:If W=2
:Then
:(B≠51)(55-B→E
:1+15(B=51
:End
:If not(W
:2(B=53)+3(B=52)+4(B=50)+7(B=51
:If B≠49
:Then
:If W=1
:4E+53-B
:If W=3
:7-B-14(B<52
:If W>3
:84-3W
:End
:Ans→D
c2
ec2

A little bit beter

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
GAME: Optimize this! (83+BASIC)
« Reply #74 on: September 12, 2007, 04:07:00 am »
oh that line, i see