Author Topic: Debugging on the Calculator  (Read 13024 times)

0 Members and 2 Guests are viewing this topic.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Debugging on the Calculator
« Reply #15 on: April 14, 2010, 07:52:24 am »
It's a great technique.  In fact, I think everyone's debugged before even if they don't know the term. ;D
Rcl is useful for the reasons stated above. :)  Thanks player for the great explanation! :D

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
Re: Debugging on the Calculator
« Reply #16 on: April 14, 2010, 12:12:53 pm »
One thing that is hard to debug it seems are logical errors x.x

I mean when you accidentally choose > instead of < and won't notice until later, then when it comes time to debug, you can't figure out why your If blocks and loops are skipped despite the right amount of End instructions x.x

_player1537

  • Guest
Re: Debugging on the Calculator
« Reply #17 on: April 14, 2010, 05:57:58 pm »
oh, I hate when that happens.  Math errors are the worst things ussually (though the math I do is ussually stealing stuff from a string, and the right amount of it).  On that topic actually, I need a simple routine that will take a part of a string (starting at one ':') and ending at the next part, as in if the string was "aaa:bbb:ccc:" and you searched through it (starting at bbb:) it would return ccc.  kinda off topic, but my current method is just a loop that scans until it reaches the ':'.

Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Re: Debugging on the Calculator
« Reply #18 on: April 14, 2010, 06:26:04 pm »
instring( is a good operation that can do that.
http://tibasicdev.wikidot.com/instring

I personally am sick of bugs making hnefatafl AI... They had so much bugs -_-;;; Still not done debugging
I personally use Pause to see where the error occurs, and counting ends. Although many times, I miscount End because I overlooked some area. When the conditionals get too complicated, I write the code on paper, and connect the Loop with End.


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*

_player1537

  • Guest
Re: Debugging on the Calculator
« Reply #19 on: April 14, 2010, 06:47:38 pm »
my old method for finding part of the string was a compicated series of Instring() to find the correct value, but it was getting annoying to have to think it through, so I just wrote the other one.  (for my rpg I'm working on).  It doesn't really matter I don't guess unless I want to use it insomething else

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Debugging on the Calculator
« Reply #20 on: April 14, 2010, 08:08:46 pm »
Can you explain what you need again, I don't think I quite understand what you're looking for (like what it needs to do). I would like to try to help.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

_player1537

  • Guest
Re: Debugging on the Calculator
« Reply #21 on: April 14, 2010, 08:11:52 pm »
basically, I have a string with the attack's name, followed and preceeded by a colon (ie ":attack1:randint(5,10):" )  I would need something that takes the "randint(5,10)" part.  "attack1" would be in str7.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Debugging on the Calculator
« Reply #22 on: April 14, 2010, 08:58:29 pm »
Well I'm not sure if I'm still understanding this correctly but from what you've said I have two thoughts of what you mean (I don't know if either are correct).

1. You have code set up like this:

Code: [Select]
":ATTACK1:randInt(5,10):→Str7
":ATTACK2:randInt(5,10):→Str6
...

or 2.

Code: [Select]
":ATTACK1:randInt(5,10):ATTACK2:randInt(5,10):...→Str7
My guess is the second one. But one thing you could do is something along the line of:

Code: [Select]
"randInt(5,10randInt(3,15randInt(6,12→Str7 //Example string to get the attack value (I'm guessing that is the use of this?)
Prompt A //The attack number.
expr(sub(Str7,5A-4,5→B //Gets the randomly generated number.

(You can apply this method with the names involved. The only restriction is that the names need to be the same length along with the random generated numbers. If that makes sense.)

I mean again I don't know if this is the kind of thing you're looking for but that's what I figured out from what you've said. Sorry if it doesn't help much :(
« Last Edit: April 14, 2010, 09:00:09 pm by meishe91 »
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

_player1537

  • Guest
Re: Debugging on the Calculator
« Reply #23 on: April 14, 2010, 09:06:13 pm »
sorry, should have explained it a little better, here goes:
Code: [Select]
"attack1->Str7
":attack1:randint(3,6):attack2:(randint(0,9001)>9000)*9000:->Str2
(code here to get the attack damage)
the second part where it picks the amount of damage can be a different size than the rest, and I would like to refrain from lists, as it is hard to add new attacks in.

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Debugging on the Calculator
« Reply #24 on: April 14, 2010, 09:12:49 pm »
Oh ok, so Str7 changes depending on the the attack chosen by the user?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

_player1537

  • Guest
Re: Debugging on the Calculator
« Reply #25 on: April 14, 2010, 09:13:33 pm »
yeah

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Debugging on the Calculator
« Reply #26 on: April 14, 2010, 09:42:28 pm »
Hmmm, ok. That makes sense. Would

Code: [Select]
"ATTACK1→Str7
":ATTACK1:randInt(5,10):ATTACK2:(randInt(0,9001)>9000)*9000:→Str2
inString(Str2,Str7)+1+length(Str7
expr(sub(Str2,Ans,inString(Str2,":",Ans)-Ans→B

work for what you need?
« Last Edit: April 14, 2010, 09:58:45 pm by meishe91 »
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Debugging on the Calculator
« Reply #27 on: April 15, 2010, 07:15:57 pm »
@_player
Did you find a good way to do it?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

_player1537

  • Guest
Re: Debugging on the Calculator
« Reply #28 on: April 15, 2010, 10:46:10 pm »
sorry, haven't tried it yet, working on a couple other projects, I'll test it in a minute :)

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Debugging on the Calculator
« Reply #29 on: April 16, 2010, 12:19:48 am »
Oh ok, sounds good.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)