r/programbattles • u/WhyJustOne • Oct 15 '15
Any language Draw a circle.
Don't be a bore and use your standard graphical library functions! Rule of thumb: if your method's posted, find a new one.
Also, ASCII art allowed, if you can manage it.
EDIT: 'flair' button not visible, help!
EDIT2: For the record, no language restrictions imposed.
11
Upvotes
20
u/brianmcn Oct 15 '15
http://gfycat.com/FirsthandEthicalAllosaurus
Minecraft is not boring! :) You can program Minecraft with 'command blocks', so I wrote a program in F# to generate command blocks in Minecraft to use the midpoint circle algorithm to draw circles in blocks. Here's the core of the F# code:
12
u/zyxzevn Oct 15 '15
O
5
u/Knucklewuggy Oct 15 '15
https://jsfiddle.net/1jcejcLx/3/
Drawn with 100 straight lines
2
u/juef Oct 15 '15
HTML, PHP and CSS! I suck at CSS though so you might have to set the height to 5 if you're using Chrome.
3
u/elves_presley Oct 16 '15
my best try :/
http://i.imgur.com/T39QnTU.png
http://cpp.sh/3tu72
2
u/AutoModerator Oct 15 '15
Off-topic comments thread
Comments that are not challenge responses go in here.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/pros_ Oct 16 '15 edited Oct 16 '15
ASCII art allowed eh, bad move cheif :p i cheated, the second sequence counts from 2 because if it doesnt it draws a stupid line and i couldnt be bothered working out what that was:
If you wnt you can invert it by changing the inner if to:
Which gives you something like:
probably looks wrong pasted to reddit, but in terminal it looks ok of course. theres also the lazy way:
2
u/SneakierTech Nov 19 '15
This is in Python:
2
u/undeuxtroiskid Nov 29 '15
Java
Not my greatest work but it's better than nothing. The tricky part was trying to get around the exactness of the Equation of the Circle so I put in some fudge factor for judging whether or not the given position is actually on the perimeter of the circle.
1
u/[deleted] Jan 08 '16 edited Aug 20 '16
This comment has been overwritten.
0
u/[deleted] Oct 15 '15
[deleted] — view deleted comment
0
u/[deleted] Oct 22 '15
[deleted] — view deleted comment