### Author Topic: [CHALLENGE]Logic and Optimization  (Read 14309 times)

0 Members and 1 Guest are viewing this topic.

#### Builderboy

• Physics Guru
• CoT Emeritus
• LV13 Extreme Addict (Next: 9001)
• Posts: 5673
• Rating: +613/-9
• Would you kindly?
##### Re: [CHALLENGE]Logic and Optimization
« Reply #30 on: November 20, 2010, 02:01:14 pm »
Code: [Select]
Prompt E,NIf N(E=2Disp "NRMLIf E=2 or N=1Disp "ALMST NRMLIf ((N!=1)E!=2Disp "WEIRD

N(E=2 won't work because if E is 2, and N is 2, it will still say Normal because N*(2=2 is 2, which is true

E=2 or N=1 won't work because if E=2 and N=1, it will still display almost normal because 1 Or 1 = 1

third one works though

#### yunhua98

• You won't this read sentence right.
• LV11 Super Veteran (Next: 3000)
• Posts: 2718
• Rating: +214/-12
• Go take a dive in the River Lethe.
##### Re: [CHALLENGE]Logic and Optimization
« Reply #31 on: November 20, 2010, 02:01:49 pm »
lol, but really, the End statements aren't needed?

 Spoiler For =====My Projects=====: Minor setback due to code messing up.  On hold for Contest.
On hold for Contest. Spoiler For ===Staff Memberships===:
Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

#### Munchor

• LV13 Extreme Addict (Next: 9001)
• Posts: 6199
• Rating: +295/-121
• Code Recycler
##### Re: [CHALLENGE]Logic and Optimization
« Reply #32 on: November 20, 2010, 02:12:02 pm »
lol, but really, the End statements aren't needed?

TI Basic ones no

#### matthias1992

• LV6 Super Member (Next: 500)
• Posts: 408
• Rating: +33/-5
##### Re: [CHALLENGE]Logic and Optimization
« Reply #33 on: November 20, 2010, 02:53:05 pm »
Code: [Select]
:Prompt E,N:If E=2 and N=1:Disp "NRML:If E != 2 or N!=1:Then:If E=2 or N=1:Then:Disp "ALMST NRML:Else:Disp "WEIRD80bytes, for the first challenge

This is missing two end statements plus it could be optimized to this:
Code: [Select]
Prompt E,NIf N(E=2Disp "NRMLIf E=2 or N=1Disp "ALMST NRMLIf ((N!=1)E!=2Disp "WEIRD

Yours uses 6 bytes more, and mine is not missing two end statements. It is the end of a program so it does not need them.
I was refering to ScoutDavid's code not yours.
Code: [Select]
Prompt E,NIf N(E=2Disp "NRMLIf E=2 or N=1Disp "ALMST NRMLIf ((N!=1)E!=2Disp "WEIRD

N(E=2 won't work because if E is 2, and N is 2, it will still say Normal because N*(2=2 is 2, which is true

E=2 or N=1 won't work because if E=2 and N=1, it will still display almost normal because 1 Or 1 = 1

third one works though
Ok scrap it I thought I was good at basic, I guesss I was wrong
« Last Edit: November 20, 2010, 02:53:38 pm by matthias1992 »
MASM xxxxxxxxxx aborted | SADce ====:::::: 40% -Halted until further notice| XAOS =====::::: 50% -Units done| SKYBOX2D engine ========== 100% -Pre-alpha done. Need to  document it and extend |

~Those who dream by day are cognizant of much more than those who dream by night only. -Sir Edgar Allen Poe-

#### Munchor

• LV13 Extreme Addict (Next: 9001)
• Posts: 6199
• Rating: +295/-121
• Code Recycler
##### Re: [CHALLENGE]Logic and Optimization
« Reply #34 on: November 22, 2010, 08:33:50 am »
Code: [Select]
:Prompt E,N:If E=2 and N=1:Disp "NRML:If E != 2 or N!=1:Then:If E=2 or N=1:Then:Disp "ALMST NRML:Else:Disp "WEIRD80bytes, for the first challenge

This is missing two end statements plus it could be optimized to this:
Code: [Select]
Prompt E,NIf N(E=2Disp "NRMLIf E=2 or N=1Disp "ALMST NRMLIf ((N!=1)E!=2Disp "WEIRD

Yours uses 6 bytes more, and mine is not missing two end statements. It is the end of a program so it does not need them.
I was refering to ScoutDavid's code not yours.
Code: [Select]
Prompt E,NIf N(E=2Disp "NRMLIf E=2 or N=1Disp "ALMST NRMLIf ((N!=1)E!=2Disp "WEIRD

N(E=2 won't work because if E is 2, and N is 2, it will still say Normal because N*(2=2 is 2, which is true

E=2 or N=1 won't work because if E=2 and N=1, it will still display almost normal because 1 Or 1 = 1

third one works though
Ok scrap it I thought I was good at basic, I guesss I was wrong

You shouldn't say that!

I need to move to Axe in Cage Match, since I suck at TI Basic :S

#### DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55851
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: [CHALLENGE]Logic and Optimization
« Reply #35 on: November 22, 2010, 01:45:15 pm »
Are End statements needed if the program being run is a sub-program?
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF

• Guest
##### Re: [CHALLENGE]Logic and Optimization
« Reply #36 on: November 22, 2010, 01:47:10 pm »
yes, it compiles it as another program, but places the EXEC in the final product.  But if you do return, then it WON'T go back to the main prog, it end the whole thing.  To go back to the main prog, redirect to the last line of code.

EDIT: and yes ENDs are needed too
« Last Edit: November 22, 2010, 01:47:53 pm by ASHBAD_ALVIN »

#### Builderboy

• Physics Guru
• CoT Emeritus
• LV13 Extreme Addict (Next: 9001)
• Posts: 5673
• Rating: +613/-9
• Would you kindly?
##### Re: [CHALLENGE]Logic and Optimization
« Reply #37 on: November 22, 2010, 01:52:07 pm »
In certain cases you don't need an End, if it is on the last line of an IfThen statement.  Like this saves 2 bytes in the subprogram by not including the End

1st program
Code: [Select]
1->GAMEPrgmADisp ":D
sub program
Code: [Select]
If GAME=1:ThenDisp "You Lost9001->Game

• Guest
##### Re: [CHALLENGE]Logic and Optimization
« Reply #38 on: November 22, 2010, 01:53:09 pm »
Hmm, I never noticed that before.  I feel informed very much so inde

#### DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55851
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: [CHALLENGE]Logic and Optimization
« Reply #39 on: November 22, 2010, 01:56:56 pm »
yes, it compiles it as another program, but places the EXEC in the final product.  But if you do return, then it WON'T go back to the main prog, it end the whole thing.  To go back to the main prog, redirect to the last line of code.

EDIT: and yes ENDs are needed too
This is BASIC, actually, not Axe. (Noticing you say "compiles")
In certain cases you don't need an End, if it is on the last line of an IfThen statement.  Like this saves 2 bytes in the subprogram by not including the End

1st program
Code: [Select]
1->GAMEPrgmADisp ":D
sub program
Code: [Select]
If GAME=1:ThenDisp "You Lost9001->Game
Ah ok I see. And I lost the game.
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF

• Guest
##### Re: [CHALLENGE]Logic and Optimization
« Reply #40 on: November 22, 2010, 01:58:50 pm »
OH THIS IS BASIC.  I see -- I thought this was Axe.  Better look more carefully next time

#### DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55851
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: [CHALLENGE]Logic and Optimization
« Reply #41 on: November 22, 2010, 02:22:01 pm »
No problem. That happens.
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF

#### gangsterveggies

• LV2 Member (Next: 40)
• Posts: 36
• Rating: +2/-1
• Asm rules
##### Re: [CHALLENGE]Logic and Optimization
« Reply #42 on: November 22, 2010, 07:47:30 pm »
Why did you choose such an odd program?
I'm waiting for someone to do a calc Farmville. Maybe one day I'll do it!

#### DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55851
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
##### Re: [CHALLENGE]Logic and Optimization
« Reply #43 on: November 23, 2010, 12:00:24 am »
Because it's just for the sake of optimizations. We need to keep the programs small at first.

I doubt many people will participate if the programs to optimize are The Reign of Legends 3.
« Last Edit: November 23, 2010, 12:00:50 am by DJ Omnimaga »
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF