Live data from Hacker News

A list of practical projects that anyone can solve in any programming language

github.com

31–40 of 67 posts

Re: A list of practical projects that anyone can solve in any programming language

#31
post #29

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)

What you wrote just returns 0 for a large enough n.

Re: A list of practical projects that anyone can solve in any programming language

#32
i would love to see these projects and solutions be contributed to https://rosettacode.org/

the 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

#33
post #30

Earlier 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...

Here's an example if you want to try http://www.benzedrine.ch/pi-spigot.c

Re: A list of practical projects that anyone can solve in any programming language

#34
Recently implemented A* Path finding algo using Go as a way to learn Go. Couldn't help myself and went ahead and added a UI layer on top of it using a 2d game library called Ebiten.

Very 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

#35
post #30

Earlier 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

This doesn't look like a spigot algorithm. It has a link in the comments[1], it calculates the digits of PI from the beginning. The code you linked seems to implement the exact same algorithm.

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.

[1] http://www.codecodex.com/wiki/Calculate_digits_of_pi#C

Re: A list of practical projects that anyone can solve in any programming language

#36
post #31
post #29

Earlier quoted context omitted.

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)

What you wrote just returns 0 for a large enough n.

Serves me right for stopping the reading on the first line :)

Re: A list of practical projects that anyone can solve in any programming language

#37

Writing 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.

I started a game clone challenges[1] list, but haven’t had much time to work on it.

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

3. http://chi.cs.uchicago.edu/index.html

4. https://github.com/jorgegonzalez/beginner-projects

Re: A list of practical projects that anyone can solve in any programming language

#38

Not 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.

> what is the point of reinventing the wheel?

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

#39

Additional one which I found very fun to dick around with: a symbolic calculator capable of doing simple differentiation and integration.

I have also played around with differentiation. I even wrote a template metaprogram in C++ that could differentiate formulas in compile time. However integration is tough, I have never attempted to do it.

Re: A list of practical projects that anyone can solve in any programming language

#40

Not 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.

> what is the point of reinventing the wheel?

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.

Post reply on HN