Earlier quoted context omitted.
You don't need arbitrary precision, use a spigot https://en.wikipedia.org/wiki/Pi#Spigot_algorithms
Wow, this blew my mind. And it's so simple, too. def nthHexDigitOfPI(n): return 4/(8*n+1) - 2/(8*n+4) - 1/(8*n+5) - 1/(8*n+6)
A list of practical projects that anyone can solve in any programming language
31–40 of 67 posts
Re: A list of practical projects that anyone can solve in any programming language
#32the readme mentions rosettacode as inspiration, which is great. i live the idea of working on tasks through git, but i'd love it even more if i could work on rosettacode tasks directly this way.
greetings, eMBee.
Re: A list of practical projects that anyone can solve in any programming language
#33Earlier quoted context omitted.
You don't need arbitrary precision, use a spigot https://en.wikipedia.org/wiki/Pi#Spigot_algorithms
I took a look at a spigot algorithm[1]. I still think it needs arbitrary precision arithmetics but maybe I miss something obvious. [1] https://en.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%9...
Re: A list of practical projects that anyone can solve in any programming language
#34Very fun little project! Got a hairy bug, which took me about 1-2 hours to figure out, which involved not realising that when I created a struct and added it to a slice, it was not the same struct as I had just created, in terms of memory address!
So in pseudo code:
myThing := struct{attributes...} mySlice[0] := myThing sameThing := mySlice[0] &sameThing == &myThing False
Definitely know Go a lot better now. Looking forward to doing some others on this list.
Re: A list of practical projects that anyone can solve in any programming language
#35Earlier quoted context omitted.
I took a look at a spigot algorithm[1]. I still think it needs arbitrary precision arithmetics but maybe I miss something obvious. [1] https://en.wikipedia.org/wiki/Bailey%E2%80%93Borwein%E2%80%9...
Here's an example if you want to try http://www.benzedrine.ch/pi-spigot.c
I don't fully comprehend the code still, but the SCALE parameter suggest that it handles the elements of the array as a fixed point representation of real numbers. I wonder if it's correct for large number of digits.
Re: A list of practical projects that anyone can solve in any programming language
#36Re: A list of practical projects that anyone can solve in any programming language
#37Writing a game should be on the list as well. You touch many of the listed topics, and some more, have to combine them in an efficient way, and also it's fun. And your can write games of any complexity level.
Some more project related resources are awesome-for-beginners[2], The UChicago X-Projects[3], and Beginner Projects[4].
1. https://github.com/rby90/Game-Clone-Challenges
2. https://github.com/MunGell/awesome-for-beginners
Re: A list of practical projects that anyone can solve in any programming language
#38Not only do I doubt that "anyone" can write these programs, most of them do not look particularly interesting or fun. Many if not all of the non-mathematical ones are simply replicating off-the-shelf utilities or tools; what is the point of reinventing the wheel? Even if you are looking to hone your skills in a new language, creating something genuinely new seems like it would be more useful and motivational.
For many of us (me included), it's not REinventing the wheel, it's inventing it. I've taken a quick look through here, and some of these are in the 'yeah, I can do that straight off' category, some are in the 'I -think- I could do that' and some are in the '...right.... I'm not sure how I'd approach that' category. Remember that not everyone is in the same boat as you, and at the same level. I'm sure I'm way behind 99% of the people on HN, so maybe this is the wrong audience.
In addition, there's also the element of the development of the wheel - after all, they used to be wooden, and then gained a steel tyre, a proper bearing, etc... The code you create today may well be completely different (and hopefully better in every respect) than the code from yesteryear.
>Even if you are looking to hone your skills in a new language, creating something genuinely new seems like it would be more useful and motivational.
Maybe, but sometimes having the limitation of producing a specific thing can be useful - certainly when teaching music in the past, there has been room for both approaches, and I think that carries across into coding. There are also plenty of people who don't know -what- to create, and anything they look at is such a massive, difficult project combining multiple skills they may not have 100% down that it's probably better to do some simple 'test pieces' like I had to do when I was an engineering apprentice.
Re: A list of practical projects that anyone can solve in any programming language
#39Additional one which I found very fun to dick around with: a symbolic calculator capable of doing simple differentiation and integration.
Re: A list of practical projects that anyone can solve in any programming language
#40Not only do I doubt that "anyone" can write these programs, most of them do not look particularly interesting or fun. Many if not all of the non-mathematical ones are simply replicating off-the-shelf utilities or tools; what is the point of reinventing the wheel? Even if you are looking to hone your skills in a new language, creating something genuinely new seems like it would be more useful and motivational.
Making a wheel is pretty much the "Hello, world!" of engineering. It ensures that you know how to operate the equipment, procure materials, safely work them, and retrieve the finished product from the machinery.
Just getting started with a lathe? Go make a wheel. Just got a 3D printer? Go make a wheel. Just getting started with a whittling knife? Go make a wheel.