Draw Some Shapes!
Huh?
I know, I know. Easy right? Suddenly today I decided I wanted to mess with drawing shapes because it's fun to be completely honest. It turned into more than just a normal shape function. Going crazy with it showed me that one could really learn a lot from messing with this stuff!
Why do I care?
Well you don't have to, but personally learning projects like this are always interesting to me!
The Challenge
If you're up for it, I challenge people to create a function that does shape drawing as dynamically as possible. You would input amount of lines to cover and it would do the rest!
This is exponentially harder respective to the amount of sides of the shape you choose, but don't worry! All that you learn from it will be of great benefit to any future projects!
If you're interested, read on:
Goals
I see you're interested :)
Pleas make your script in a repl.it repository and comment with the link to it. When you're done, if you think it was too easy, maybe try a larger shape :)
Your script should
- make a shape when called (Duh)
- use almost entirely dynamic variables
- handle all errors
- be fast
That's it! Have fun obviously, but try to challenge yourself, making a function for a triangle is going to be the easiest, pick more complex shapes if you want a challenge!
I'm definitely interested in seeing what you guys do, and as a side note, this does not need to be written in Python. Use any language you'd like!
Below is my example of a triangle function:
Ah yes, I crashed my potato.
repl process died unexpectedly: signal: killed
??
@epicman702 that happens if it takes too long to compute something
@Nettakrim I did enter the number 9999999999...
@epicman702 Thatll do it...
@epicman702 Large number, I see
i put in 99 and it did ----------------????-----------etc
https://repl.it/@OOF1234567/learn-code mine is very simple but gets the job done
@OOF1234567 I'm not completely sure how turtle works, but I guess it does what was intended lol. Was more hinting towards a custom module to do it yourself though.
No worries either way, still a cool program! Thanks for participating!
@slickassassin03 turtle works with python to draw lines, so in other words it makes drawing easy if you dont wanna code a lot to make a shape, its pretty cool and easy to learn
went from 'hey, that's cool, i wanna try' to 2d shape filling algorithms really quick. works, though. here to fill shapes.
@aidanpatterson0 Not gonna lie, this is pretty impressive. Great script man, not something I probably could have done personally.
@slickassassin03 i’m a shader girl, so my first instinct was, of course, to implement shader algorithms in python.
If you type 'int', it breaks
@MadMath123 Not for me it doesn't
nice
Very cool, I accept your challenge!
@IreoluwaRaufu Can't wait to see what you come up :)
cool
coolio
10000...
awesome amazing never better
lol i put 600 (ow)
The triangle is warping...
@CodeABC123 Tried out a large number I see...