Author Topic: Flag variable in TI-BASIC  (Read 2496 times)

0 Members and 1 Guest are viewing this topic.

Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Flag variable in TI-BASIC
« on: May 08, 2012, 10:04:57 pm »
I thought this very handy routine should be shared. It's not mine, credit goes to Runer112 and jacobly. They helped me find a really compact way to store the flags in a variable (total of 44 flags per single variable!)

Write these codes as is in the beginning of the program. Make sure you're not in radial mode if you plan to use graph screen.
Code: [Select]
"iPart(2fPart(Ans2^-θ→r₁
"Ans-2^θ/2r₁→r₂
"Ans+2^θ/2not(r₁→r₃

In order to utilize the above routine, you use these when you need to work with flags
Code: [Select]
A:r₁(B to get
A:r₂(B→A to reset
A:r₃(B→A to set

So let's say you have 4 flags, and they are in the variable F. In order to see what 3rd flag is, you do:
F:r₁(3
In order to reset (make flag 0) the 2nd flag, you do
F:r₂(2
and so on.

This is a lot better and more efficient, then let's say setting each flag per element in a list.
like, L1(1,0,0,1,1,1,0,1,0,1,1,0,1,0,0
etc. when you can store all that in a single variable as '20148' and extract each flag by using the above method.

Just make sure the value doesn't contain more than 44 flags because after that you will lose accuracy due to how TI handles the number.
« Last Edit: May 09, 2012, 07:58:13 pm by jsj795 »


Spoiler For funny life mathematics:
1. ROMANCE MATHEMATICS
Smart man + smart woman = romance
Smart man + dumb woman = affair
Dumb man + smart woman = marriage
Dumb man + dumb woman = pregnancy
2. OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime
3. SHOPPING MATH
A man will pay $2 for a $1 item he needs.
A woman will pay $1 for a $2 item that she doesn't need.
4. GENERAL EQUATIONS & STATISTICS
A woman worries about the future until she gets a husband.
A man never worries about the future until he gets a wife.
A successful man is one who makes more money than his wife can spend.
A successful woman is one who can find such a man.
5. HAPPINESS
To be happy with a man, you must understand him a lot and love him a little.
To be happy with a woman, you must love her a lot and not try to understand her at all.
6. LONGEVITY
Married men live longer than single men do, but married men are a lot more willing to die.
7. PROPENSITY TO CHANGE
A woman marries a man expecting he will change, but he doesn't.
A man marries a woman expecting that she won't change, and she does.
8. DISCUSSION TECHNIQUE
A woman has the last word in any argument.
Anything a man says after that is the beginning of a new argument.

Girls = Time * Money (Girls are a combination of time and money)
Time = Money (Time is money)
Girls = Money squared (So, girls are money squared)
Money = sqrt(Evil) (Money is also the root of all evil)
Girls = sqrt(Evil) squared (So, girls are the root of all evil squared)
Girls = Evil (Thus, girls are evil)
*Girls=Evil credit goes to Compynerd255*

Offline blue_bear_94

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 801
  • Rating: +25/-35
  • Touhou Enthusiast / Former Troll / 68k Programmer
    • View Profile
Re: Flag variable in TI-BASIC
« Reply #1 on: May 09, 2012, 04:10:22 pm »
Actually...
Code: [Select]
A:r₁(B to get
A:r₂(B→A to reset
A:r₃(B→A to set

Anyway, this is a very useful routine!
Due to dissatisfaction, I will be inactive on Omnimaga until further notice. (?? THP hasn't been much success and there's also the CE. I might possibly be here for a while.)
If you want to implore me to come back, or otherwise contact me, I can be found on GitHub (bluebear94), Twitter (@melranosF_), Reddit (/u/Fluffy8x), or e-mail (if you know my address). As a last resort, send me a PM on Cemetech (bluebear94) or join Touhou Prono (don't be fooled by the name). I've also enabled notifications for PMs on Omnimaga, but I don't advise using that since I might be banned.
Elvyna (Sunrise) 4 5%
TI-84+SE User (2.30 2.55 MP 2.43)
TI-89 Titanium User (3.10)
Casio Prizm User? (1.02)
Bag  東方ぷろの

Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Re: Flag variable in TI-BASIC
« Reply #2 on: May 09, 2012, 07:57:57 pm »
Actually...
Code: [Select]
A:r₁(B to get
A:r₂(B→A to reset
A:r₃(B→A to set

Anyway, this is a very useful routine!

Ahhh yes true. I forgot, will edit it in :)


Spoiler For funny life mathematics:
1. ROMANCE MATHEMATICS
Smart man + smart woman = romance
Smart man + dumb woman = affair
Dumb man + smart woman = marriage
Dumb man + dumb woman = pregnancy
2. OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime
3. SHOPPING MATH
A man will pay $2 for a $1 item he needs.
A woman will pay $1 for a $2 item that she doesn't need.
4. GENERAL EQUATIONS & STATISTICS
A woman worries about the future until she gets a husband.
A man never worries about the future until he gets a wife.
A successful man is one who makes more money than his wife can spend.
A successful woman is one who can find such a man.
5. HAPPINESS
To be happy with a man, you must understand him a lot and love him a little.
To be happy with a woman, you must love her a lot and not try to understand her at all.
6. LONGEVITY
Married men live longer than single men do, but married men are a lot more willing to die.
7. PROPENSITY TO CHANGE
A woman marries a man expecting he will change, but he doesn't.
A man marries a woman expecting that she won't change, and she does.
8. DISCUSSION TECHNIQUE
A woman has the last word in any argument.
Anything a man says after that is the beginning of a new argument.

Girls = Time * Money (Girls are a combination of time and money)
Time = Money (Time is money)
Girls = Money squared (So, girls are money squared)
Money = sqrt(Evil) (Money is also the root of all evil)
Girls = sqrt(Evil) squared (So, girls are the root of all evil squared)
Girls = Evil (Thus, girls are evil)
*Girls=Evil credit goes to Compynerd255*