π in C#
AmazingMech2418 (1039)

I think I'm pretty much doing pi approximations in every language now, so, here it is in C#!

Here are the other approximations so far:
Bash - https://repl.it/talk/share/p-in-Bash/36133
Kotlin - https://repl.it/talk/share/p-in-Kotlin/36125
Ruby - https://repl.it/talk/share/p-in-Ruby/34982
Java - https://repl.it/talk/share/p-in-Java/34978
QBasic - https://repl.it/talk/share/p-in-QBasic/34973
Fortran - https://repl.it/talk/share/p-in-Fortran/34890
APL - https://repl.it/talk/share/p-in-APL/34888
Forth - https://repl.it/talk/share/p-in-Forth/34652
LOLCODE - https://repl.it/talk/share/p-in-LOLCODE/34421
Python and Node.js (Node is linked in post) - https://repl.it/talk/share/2-Approximations-of-p-In-Only-Four-Lines-of-Code/32773
C - https://repl.it/talk/share/p-Approximations-in-C/33461

Credit to @NoelBryan, @TheForArkLD , @Warhawk947 , and @LizFoster for inspiring these approximations. Most of these use the Nilakantha Series, although I also use the arctangent method (multiplying the radian arctangent of 1 by 4 to get pi and getting the arctangent with an infinite series) in three of them (Python, Node, and C).

You are viewing a single comment. View All
LizFoster (648)

@AmazingMech2418 WWWWWWWWWWW

So, I have made several optimizations overall, the biggest one so far being that I removed the show() function from a class, which should save some space and memory (I will have to write fewer lines overall). I have also removed the SPRITE class, since it is not in use at the moment, and I would rather worry about it when it is absolutely necessary.

I removed the black border and extra screen size, since it was a pointless addition. Finally, I have removed the MOVEPLAYER class, and the win.onkey commands related to this. It was just taking up space when it was not needed..

Do you have any more suggestions? If need be, I can invite you to the repl.