Discuss Scratch

JRR078
Scratcher
56 posts

Order of Operations instead of center-out

With the math blocks:
(() + ())
(() - ())
(() * ())
and
(() / ())
Instead of center-out, why not use Order of Operations?
Also, a
( (()) ) (in parentheses)
block would be great!
Order of Operations:
Parentheses
Exponents (If ()^() is added)
Multiplication/Division (Left to right)
Addition/Subtraction (Left to right)
So… instead of 5*3/8-9*5 equaling -0.405405, it would equal -43.125

Last edited by JRR078 (Dec. 1, 2016 13:36:05)

Sigton
Scratcher
1000+ posts

Order of Operations instead of center-out

The order of operations depends on the order you put the scratchblocks in. If you put them in correctly, then you will get the correct answer of -43.125

Sigton
explodingtoilet
Scratcher
100+ posts

Order of Operations instead of center-out

BIG WORDS BIG WORDS, WHATS GOING ON HERE???
Sigton
Scratcher
1000+ posts

Order of Operations instead of center-out

explodingtoilet wrote:

Big words, big words, what's going on here?
I recommend you google Order of Operations, BODMAS/BIMDAS/PEMDAS (One of them, depends on where you're from )

Sigton
gdpr533f604550b2f20900645890
Scratcher
1000+ posts

Order of Operations instead of center-out

Scratch is intuitive because of its block grammar. Each block simply returns a value to the one under it. Evaluating using PEMDAS regardless of the structure of the expression is not as simple. In addition, Scratch scripts are represented as a tree and interpreted by evaluating the root block, which evaluates its children if necessary, so a PEMDAS order of evaluation may not be feasible to program. Most importantly, changing the order of evaluation would break many projects.

Lisp is another programming language that does not use the order of operations. Internally, Scratch scripts greatly resemble Lisp's s-expressions.
JRR078
Scratcher
56 posts

Order of Operations instead of center-out

OK, It's just I'm more familiar with Order of Operations PEMDAS.

Last edited by JRR078 (Dec. 1, 2016 23:58:22)

MitchIsCool73
Scratcher
1 post

Order of Operations instead of center-out

You can still make something to do what you want. Just follow Scratch's rules… not your's. I wish it had Order of Operations too.

Last edited by MitchIsCool73 (June 18, 2019 10:35:43)

ResExsention
New Scratcher
1000+ posts

Order of Operations instead of center-out

MitchIsCool73 wrote:

You can still make something to do what you want. Just follow Scratch's rules… not your's. I wish it had Order of Operations too.

Necropost? Maybe not.

Support. I didn't realize it wasn't order of operations, that could've spoiled a lot of projects of mine if I hadn't known this.
WindOctahedron
Scratcher
1000+ posts

Order of Operations instead of center-out

Okay…

ResExsention wrote:

Necropost? Maybe not.
…if it isn't, then no support. Why? Because everything already is in parentheses!
(((3) * (5)) + (4)) // Returns "19" (the equation is "(3x5)+4").
((3) * ((5) + (4))) // Returns "27" (the equation is "3x(5+4)").
JRR078
Scratcher
56 posts

Order of Operations instead of center-out

WindOctahedron wrote:
…Why? Because everything already is in paranteses!
Sure, but, come on. Do you think someone, who's used to Order of Operations is going to take their time to make sure the equation is just right to get what they're looking for? I could see someone without the patience or the time to go through the equation and get it right, especially with bigger equations.
Za-Chary
Scratcher
1000+ posts

Order of Operations instead of center-out

JRR078 wrote:

WindOctahedron wrote:
…Why? Because everything already is in paranteses!
Sure, but, come on. Do you think someone, who's used to Order of Operations is going to take their time to make sure the equation is just right to get what they're looking for? I could see someone without the patience or the time to go through the equation and get it right, especially with bigger equations.
As @WindOctahedron pointed out, I just visualize these operators as parentheses. Every time you insert a new arithmetic block, you insert a new set of parentheses. This follows the usual order of operations because, by PEMDAS, stuff in parentheses are always evaluated first.
coder2045
Scratcher
1000+ posts

Order of Operations instead of center-out

Sigton wrote:

explodingtoilet wrote:

Big words, big words, what's going on here?
I recommend you google Order of Operations, BODMAS/BIMDAS/PEMDAS (One of them, depends on where you're from )

Sigton
What about BEDMAS?

Powered by DjangoBB