Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
66

Draw Some Shapes!

slickassassin03
slickassassin03

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:

3 years ago

Voters

Comments

TopNew
5

The triangle is warping...

3 years ago
2
slickassassin03
slickassassin03

@CodeABC123
Tried out a large number I see...

3 years ago
3
cf20600
cf20600

Ah yes, I crashed my potato.

3 years ago
2
MadMath123
MadMath123

If you type 'int', it breaks

3 years ago
2
YeetMstr
YeetMstr

repl process died unexpectedly: signal: killed

??

3 years ago
1
Nettakrim
Nettakrim

@epicman702
that happens if it takes too long to compute something

3 years ago
5
YeetMstr
YeetMstr

@Nettakrim
I did enter the number 9999999999...

3 years ago
1
AtriDey
AtriDey

@epicman702
Large number, I see

3 years ago
1
LILLIANANUCCIO
LILLIANANUCCIO

This is cool but when it says Filled with what I thought it was going to fill with a color

1 year ago
1
McodeMaker
McodeMaker

i put in 99 and it did ----------------????-----------etc

2 years ago
1
OOF1234567
OOF1234567

https://repl.it/@OOF1234567/learn-code mine is very simple but gets the job done

3 years ago
1
slickassassin03
slickassassin03

@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!

3 years ago
1
OOF1234567
OOF1234567

@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

3 years ago
1
aidanpatterson0
aidanpatterson0

went from 'hey, that's cool, i wanna try' to 2d shape filling algorithms really quick. works, though. here to fill shapes.

3 years ago
1
slickassassin03
slickassassin03

@aidanpatterson0
Not gonna lie, this is pretty impressive. Great script man, not something I probably could have done personally.

3 years ago
1
aidanpatterson0
aidanpatterson0

@slickassassin03
i’m a shader girl, so my first instinct was, of course, to implement shader algorithms in python.

3 years ago
Load more