--> [TI-83+ BASIC] routine help --> -->

Author Topic: [TI-83+ BASIC] routine help  (Read 8033 times)

0 Members and 1 Guest are viewing this topic.

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
[TI-83+ BASIC] routine help
« on: September 12, 2006, 11:38:00 am »
I need help because this routine doesn't work i need a routine the returns zero if C or D or E or F not equal to zero and return zero if G!=8 or 80 or H!=8 or 48. Heres my code that doesnt work. I need it to return one only when both are right

(((G=8 or G=80) or (H=8 or H=48)) and (C or D or E or F=12))
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
[TI-83+ BASIC] routine help
« Reply #1 on: September 12, 2006, 08:11:00 pm »
QuoteBegin-Killerplayer+12 Sep, 2006, 17:38-->
QUOTE (Killerplayer @ 12 Sep, 2006, 17:38)
I need help because this routine doesn't work i need a routine the returns zero if C or D or E or F not equal to zero and return zero if G!=8 or 80 or H!=8 or 48. Heres my code that doesnt work. I need it to return one only when both are right

(((G=8 or G=80) or (H=8 or H=48)) and (C or D or E or F=12))


0 if c or d or e or f !=0
0 if g!=8 or 80 or H!=8 or 48  

 I thought you posted this in your Glatic thread, but I thought it over and found a simple solution:
c1
-->
CODE
ec1(G=8 or G=80 or H=8 or H=48) and max(0={C,D,E,Fc2
ec2

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
[TI-83+ BASIC] routine help
« Reply #2 on: September 13, 2006, 11:09:00 am »
o sweet thanks and yes i did but no one answered :(sad.gif
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
[TI-83+ BASIC] routine help
« Reply #3 on: September 13, 2006, 11:26:00 am »
QuoteBegin-Killerplayer+13 Sep, 2006, 17:09-->
QUOTE (Killerplayer @ 13 Sep, 2006, 17:09)
o sweet thanks and yes i did but no one answered :(sad.gif

 I was going to back then, but couldn't figure it out...the way you said it seems odd, but I got it now :Ptongue.gif.

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
[TI-83+ BASIC] routine help
« Reply #4 on: September 13, 2006, 02:25:00 pm »
sometimes i think asking help in your project thread is a bad idea since all ppl care about is the game progress and screenies

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
[TI-83+ BASIC] routine help
« Reply #5 on: October 14, 2006, 07:03:00 am »
Dies anyone know how you can type If Str1="A" or "B" without iit saying a syntax error occured
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline Spellshaper

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1690
  • Rating: +0/-0
  • This is me. Or maybe not.
    • View Profile
[TI-83+ BASIC] routine help
« Reply #6 on: October 14, 2006, 08:10:00 am »
how about:

If Str1="A" or Str1="B

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
[TI-83+ BASIC] routine help
« Reply #7 on: October 14, 2006, 02:59:00 pm »
yea I knew of that way but I'm rele going to be doing it for about 50 chars(i should have told you that) so that would take up mucho space
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
[TI-83+ BASIC] routine help
« Reply #8 on: October 14, 2006, 05:20:00 pm »
Well if you are looking for speed vs. size, that would be the fastest. Now if you want size vs. speed, then you could do this:
c1-->
CODE
ec1DelVar XRepeat Ans
X+1->X
inString("AB..etc",Str1,X
Endc2
ec2
Amazingly it is even faster >.>, or at least not any bit noticable..Go with the code I posted, it is just as fast (if not faster) and smaller.

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
[TI-83+ BASIC] routine help
« Reply #9 on: October 15, 2006, 04:20:00 am »
I don't follow that cause I actualy need something like
If Str1="A" or "B" or "C" or "D" or "E" or "F" or ...:Then
code
End
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline Radical Pi

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1143
  • Rating: +5/-2
    • View Profile
    • RealityRevolution
[TI-83+ BASIC] routine help
« Reply #10 on: October 15, 2006, 04:26:00 am »
If inString(Str1,"A B C D E F"
Then
XXX
End

Separate the A's and B's with spaces.
One of these days I'll get a sig I'm really proud of.

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
[TI-83+ BASIC] routine help
« Reply #11 on: October 15, 2006, 07:29:00 am »
c1-->
CODE
ec1DelVar XRepeat Ans or X=26;If inString works or it reaches the end quit loop
X+1->X;advance the pointer
inString("ABCDEFGHIJKLMNOPQRSTUVWXYZ",Str1,X->O;testing, store into O
End;hope you know this
If O:then;if inString contain what Str1 did, then excute this code. if it didnt find it, it continues onward
...
End
c2
ec2
This will work, try it for yourself.

Offline Halifax

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1334
  • Rating: +2/-1
    • View Profile
    • TI-Freakware
[TI-83+ BASIC] routine help
« Reply #12 on: October 15, 2006, 09:08:00 am »
kk thanks kalan_vod
There are 10 types of people in this world-- those that can read binary, and those that can't.

Offline kalan_vod

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2715
  • Rating: +10/-0
    • View Profile
    • kalanrock.us
[TI-83+ BASIC] routine help
« Reply #13 on: October 15, 2006, 11:57:00 am »
QuoteBegin-Killerplayer+15 Oct, 2006, 15:08-->
QUOTE (Killerplayer @ 15 Oct, 2006, 15:08)
kk thanks kalan_vod  

 Np, if you don't understand any of it let me know as I know it is difficult to understand others code. Also, this is rather interesting as it would help me also :Ptongue.gif. Strings are faster as we all know, but seeing this it makes it prove it (if you did the same thing but with a list).

burr

  • Guest
[TI-83+ BASIC] routine help
« Reply #14 on: October 16, 2006, 06:07:00 am »
QuoteBegin-kalan_vod+13 Sep, 2006, 2:11-->
QUOTE (kalan_vod @ 13 Sep, 2006, 2:11)
c1-->
CODE
ec1(G=8 or G=80 or H=8 or H=48) and max(0={C,D,E,Fc2
ec2

You did a good job optimizing, but you forgot to do some http://tibasicdev.wikidot.com/optimize. I'm surprised PiMan didn't say anything, because I know he knows them :Dbiggrin.gif

c1
-->
CODE
ec1(36=abs(G-44) or 20=abs(H-28))max(0={C,D,E,Fc2
ec2

 

\n\t\t\t\t\t\t\t\t\t
<' + '/div>\n\t\t\t\t\t\t\t\t\t