-
Notifications
You must be signed in to change notification settings - Fork 294
Complex Numbers Extension #1861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| } | ||
| Scratch.extensions.register(new ScratchComplex()); | ||
| })(Scratch); | ||
| })(Scratch); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean format only works if the very last line is empty??????????????????????
|
Interesting, I also made one of the same thing, but for personal use. |
- fix breakage when diff contains very long line (#1861) - unhardcode repository - add more logging
- fix breakage when diff contains very long line (TurboWarp#1861) - unhardcode repository - add more logging
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tested this fully yet, but it loads and seems to work
If this is your first extension, nice job! Here's just a few tips to make it better:
Avoid using the master branch, create a new branch for each pull request you'd like to submit for organization purposes.
| } | ||
|
|
||
| class ScratchComplex { | ||
| constructor() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if constructor is empty may I ask why it's here? Maybe just a clarification thing
| complexSyntaxMode: { | ||
| acceptReporters: false, | ||
| items: ["simple (faster)", "advanced (slower)"], | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Menus should be translated as well, use this structure for each item:
item: {
text: Scratch.translate("simple"),
value: "simple",
}
| "itchio", | ||
| "gamejolt", | ||
| "obviousAlexC/newgroundsIO", | ||
| "BonesYT/ScratchComplex", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why'd you put this at the bottom? It doesn't really matter but you could put it near other similar extensions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Images aren't supposed to have text because of translation but I guess this is okay...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Github did something weird with displaying the diff... but sure
|
Hi @BonesYT !
I may or may not made something similar (like, with more blocks and such...) see #2113 for more :D
Anyways, I'm working on updating my extension, because it's wierd with every letter. Plus, I found how to implement Quaternions, and maybe have more optimization ideas for it, maybe too many...
I liked how you tackled some problems in the file. But that's not why I am here.
I was recently told about your existence, and looks like your extension has more power than mine (altho I have more blocks >:D but that's not the point either). From mathematician to cool guy, wanna work together? (or maybe we should call @penta-quark-neutro to see what optimizations he used!) |
|
There are fairly simple ways to get better performance. In the case of my extension, I simply rewrote the operations to avoid classes or calling functions. Using vectors is very efficient, but I imagine that your extension should return a string. |

I couldn't find an extension dedicated to complex numbers, you know... sqrt(-1) and stuff like that, so I made one.
This is also my first extension, and it kinda works pretty well!
All features:
Construct a complex number with real and/or imaginary component
Get the real and imaginary components of that value
Boolean to check if a number is real or not
Addition, subtraction, multiplication, division and exponentiation. And modulo.
Functions with single input, with extra: conjugate, flip, sign, atan2.
Toggle between simple and advanced syntax, for perfomance reasons. Maybe simple mode is at least slightly faster.
Examples