applejack wrote:
Temp must stand for temporary then
![]()
Edit: 13 pages... uh oh![]()
Yep.
I'm not superstitious. XD
hpotter134 did his job: http://scratch.mit.edu/projects/hpotter134/1887714
Start calculation!
Offline
Yes!
scimonster wrote:
applejack wrote:
Temp must stand for temporary then
![]()
Edit: 13 pages... uh oh![]()
hpotter134 did his job: http://scratch.mit.edu/projects/hpotter134/1887714
Start calculation!![]()
Offline
I will still be gone for about a week (managed to get access to a computer), but you may remember this post from awhile ago.
Most of the discussion of this stuff was on page 7.
Here is my original proposal for the evaluation code. Obviously, it could be cleaned up quite a bit, but it's here.
For this example, I will not include modulo (%).
Inpt: 3 + 4 * 2 / 4 ^ 2 ^ 3
//"Inpt" is set to the innermost "sub-expression" by hpotter134"''s code.
Pseudo Code:
Set t1 to (length of Inpt) //t1 is our input scanner.
Repeat until t1 = 0
If item t1 of list Inpt = (^) //scanning for ^, right to left (see page 7)
Set t2 to item (t1-1) of Inpt //t2 is our "left value"
Set t3 to item (t1+1) of Inpt //t3 is our "right value"
Replace item (t1-1) of Inpt with (10^(t2*log(t1)))
Delete item (t1) of Inpt
Delete item (t1) of Inpt
Change t1 by -1
Set t1 to 0
Repeat until t1 = (length of Inpt)
If item t1 of list Inpt = (*) //scanning for *
Set t2 to item (t1-1) of Inpt
Set t3 to item (t1+1) of Inpt
Replace item (t1-1) of Inpt with t2*t3
Delete item (t1) of Inpt
Delete item (t1) of Inpt
If item t1 of list Inpt = (/) //or also, /
Set t2 to item (t1-1) of Inpt
Set t3 to item (t1+1) of Inpt
Replace item (t1-1) of Inpt with t2/t3
Delete item (t1) of Inpt
Delete item (t1) of Inpt
Change t1 by 1
Set t1 to 0
Repeat until t1 = (length of Inpt)
If item t1 of list Inpt = (+) //scanning for +
Set t2 to item (t1-1) of Inpt
Set t3 to item (t1+1) of Inpt
Replace item (t1-1) of Inpt with t2+t3
Delete item (t1) of Inpt
Delete item (t1) of Inpt
If item t1 of list Inpt = (-) //or -
Set t2 to item (t1-1) of Inpt
Set t3 to item (t1+1) of Inpt
Replace item (t1-1) of Inpt with t2-t3
Delete item (t1) of Inpt
Delete item (t1) of Inpt
Change t1 by 1
Proceed to next bracket set.Last edited by amcerbu (2011-06-29 05:06:35)
Offline
Something like that might work, but what about all the multi-ops?
Offline
scimonster wrote:
Something like that might work, but what about all the multi-ops?
As I said earlier, multi-letter ops will evaluate as if they were bracket sets; the syntax for a multi-op is
op(parameter)
We can set up a pretty simple evaluation loop to look for multi-ops and evaluate them before the rest of the expression.
EDIT: Wait! Better idea! What if multi-ops are given a different token value ('m' for example)? We could write a pretty simple evaluation script to deal with that!
Last edited by amcerbu (2011-06-29 05:16:19)
Offline
amcerbu wrote:
EDIT: Wait! Better idea! What if multi-ops are given a different token value ('m' for example)? We could write a pretty simple evaluation script to deal with that!
I was planning on that, but I changed my mind. Maybe we should though.
Offline
I would do the calc, but I don't have Scratch (My computer crashed).
Scimonster OR amcerbu can do it
.
Offline
Hardmath123 wrote:
I would do the calc, but I don't have Scratch (My computer crashed).
![]()
Scimonster OR amcerbu can do it.
You're practically telling me to do the whole "collab" XD
amcerbu.
Offline
amcerbu wrote:
I'll be gone until next week, but when I can get ahold of a computer, I'll do it.
Until then, we should work out bugs in the existing project and start dealing with error checking.
We'll need a list of errors for that.
Offline
Get us a Beta-Tester!
Offline
I'll beta test if you would like.
Offline
My gift to all of you working on this: some scripts for simplification. It is not as good as I would have liked it to be, but it is something. I spent a long time on it, and you can put it to good use.
I've always though I could make this type of thing pretty easily, but now I see I was wrong. It would take me at least 168 hours of scratch time during which I would have to be wide awake to make one as good as this looks like it will be. This completed will be an amazing achievment. Please let me know when that happens
-LiquidMetal
Offline
LiquidMetal wrote:
I've always though I could make this type of thing pretty easily, but now I see I was wrong. It would take me at least 168 hours of scratch time during which I would have to be wide awake to make one as good as this looks like it will be. This completed will be an amazing achievment. Please let me know when that happens
-LiquidMetal
Glad to hear that.
Yes, you can beta-test
.
Offline
Since the forum topic has died, here's what I understand to be the plan:
Someone (me) writes the evaluation code.
Someone else (no clue yet - maybe LiquidMetal could get in here) writes the code for dealing with multi-letter ops: identifying multi-ops in the token list, and writing an evaluation loop.
Loads of beta-testing.
First stable release (possibly on a new account named Xenon).
Offline
amcerbu wrote:
Since the forum topic has died, here's what I understand to be the plan:
Someone (me) writes the evaluation code.
Someone else (no clue yet - maybe LiquidMetal could get in here) writes the code for dealing with multi-letter ops: identifying multi-ops in the token list, and writing an evaluation loop.
Loads of beta-testing.
First stable release (possibly on a new account named Xenon).
I don't think we need another account...
Offline
amcerbu wrote:
Someone else (no clue yet - maybe LiquidMetal could get in here) writes the code for dealing with multi-letter ops: identifying multi-ops in the token list, and writing an evaluation loop.
What are multi-ops?
Offline
LiquidMetal wrote:
amcerbu wrote:
Someone else (no clue yet - maybe LiquidMetal could get in here) writes the code for dealing with multi-letter ops: identifying multi-ops in the token list, and writing an evaluation loop.
What are multi-ops?
Ops that use multiple letters, like abs, sin, e^, etc...
I forgot to include "!" in parentheses needed, and in the checker.
Offline
Code for that is in my "gift to devs of Xenon," It just needs to be compiled into one script. Whoever is doing simplification should use that as a base. I'll help you understand it if you want, its supposed to help you to do this in less time.
Offline
Here is the revision I promised a while ago, but I haven't been in a place with internet for a few days now.
It handles multiletter ops pretty well, calling them "str" for string, and then converting that to "f1" for single argument functions, "f2" for two arguments, etc, or just replacing them with the value, if it's a multiletter constant like "pi"
I have a question though: Do we have any hopes of making this work online?
Offline
Why are multi-letter ops so hard to process?
Offline