Turtle graphics - Printable Version +- NaaLaa (https://www.naalaa.com/forum) +-- Forum: NaaLaa (https://www.naalaa.com/forum/forum-1.html) +--- Forum: NaaLaa 7 Code (https://www.naalaa.com/forum/forum-4.html) +--- Thread: Turtle graphics (/thread-76.html) Pages:
1
2
|
Turtle graphics - Tomaaz - 02-13-2024 So, here is my simple (and very basic) Turtle graphics library with two examples. Library (sorry for Polish variable names ): Code: visible katzolwia = 0 A simple example: Code: include "turtle.n7" Koch Curve: Code: include "turtle.n7" All files are attached. RE: Turtle graphics - Marcus - 02-13-2024 Can't wait to try it out! RE: Turtle graphics - johnno56 - 02-13-2024 Turtle graphics... gotta love it.... Back in "The Dark Ages" (mid to late 1980's), I can remember running turtle programs on my old 8bit Amstrad... Watching the shapes being drawn and anticipating the final result... It took "ages" to draw but it was worth the wait... Nicely done! Thank you for the memories, Tomaaz! RE: Turtle graphics - Tomaaz - 02-13-2024 Believe it or not, the only "computer science" I learned in high school was turtle graphics. RE: Turtle graphics - johnno56 - 02-13-2024 When I was in High School, computers were in the realm of big business or SciFi movies... It would be another 15 years later before I would actually own an 8 bit computer... yikes! RE: Turtle graphics - Tomaaz - 02-13-2024 I should have probably mention that the only place and time when I studied "computer science" was that high school and it was after I managed to teach myself the machine code used by 6502 processors. RE: Turtle graphics - Marcus - 02-14-2024 Before the old forum exploded I posted a basic compiler written in n7. It produced n7 assembler code that was compiled by the regular n7 compiler. Among all, it had built in turtle graphics. I haven't looked at or tried your code yet (still no computer). But after doing so, I'll probably get inspired and want to revisit my code. One of the first computers I wrote programs for was named Compis (swedish pun actually, "kompis" means friend): https://en.m.wikipedia.org/wiki/Compis The programming language was Comal and it had commands for turtle graphics. It was fun I wonder if it's possible to find a Compis somewhere today .. RE: Turtle graphics - Tomaaz - 02-14-2024 (02-14-2024, 07:28 PM)Marcus Wrote: I haven't looked at or tried your code yet (still no computer). But after doing so, I'll probably get inspired and want to revisit my code. And I'm pretty sure you will come up with something much better. My library is extremely basic. It should be named no turtle graphics as, prepare yourself, there is no... turtle on the screen. (02-14-2024, 07:28 PM)Marcus Wrote: One of the first computers I wrote programs for was named Compis (swedish pun actually, "kompis" means friend): https://en.m.wikipedia.org/wiki/Compis The programming language was Comal and it had commands for turtle graphics. It was fun I wonder if it's possible to find a Compis somewhere today .. The machine I've had a pleasure to study turtle graphics on was Elwro 800 Junior - a Polish clone of ZXSpectrum. At that time I was a happy owner of C64 and was able to write a simple demos in machine code, so "moving on" to turtle graphics was kind of funny. RE: Turtle graphics - 1micha.elok - 02-15-2024 (02-13-2024, 05:13 PM)Tomaaz Wrote: So, here is my simple (and very basic) Turtle graphics library .. I found that "these angle 0 and and 360" would be missed in the calculation, I proposed to add >= and <=, so that your function would be Code: ... RE: Turtle graphics - Tomaaz - 02-15-2024 While your code will work, it doesn't make any difference. Katzolwia represents the angle of the turtle in degrees. If the angle is bigger than 360, that function will change it to the same angle from 0..360 range. The same goes for angles smaller than 0. Of course, you can swap 360 for 0 and 0 for 360, but, like I said, it doesn't make any difference. For smaller programs you could skip that part completely. Computers can calculate trigonometric functions from numbers bigger than 360 or smaller tha 0 with no problems. I decided to include this function to prevent katzolwia to become to big or to small what could make the entire program to crash (if the number becomes to big or to small for variable to keep it). |