3 ms·
I learned how to write programs from Scratch[0]. Back in the pre-1.4 days (IIRC) there was no native sin/cos functions, so they had to be "implemented" somehow
by skulk 5y ago
I learned how to write programs from Scratch[0]. Back in the pre-1.4 days (IIRC) there was no native sin/cos functions, so they had to be "implemented" somehow to translate arbitrary angles into delta (x,y). The way that I found people did this was as follows (for sin(A), cos(A)):
Invisible sprite:
[ when I receive "sine" ]:
[ go to center ]
[ turn A degrees ]
[ move 1 step forward ]
Now, anyone that wants to know sin(A), cos(A) just has to read that sprite's X and Y position.
[0]: https://scratch.mit.edu https://scratch.mit.edu
- em3rgent0rdr 5y agoI guess scratch (or LOGO) is Turing complete, so someone could make a CPU built using a little turtle in a box where all functionality is built out of LOGO commands.
- Asraelite 5y agoIt's not just Turing complete but even practical. People have built entire CPU emulators that run pretty fast, e.g. https://scratch.mit.edu/projects/175052082/ https://scratch.mit.edu/projects/175052082/
- em3rgent0rdr 5y agoAmazing!