Good C/C++ projects

Jul 12, 2017 at 6:23pm
Hello,

I'd like someone to recommend me a good C/C++ project. I googled online, but I could only find small miniprojects or beginner projects. Could I have a few large (as in time spent and complexity) C/C++ projects of an intermediate level? I'd like projects that are not based on a library (QT, OpenCV, etc), and are interesting (I saw a rubix cube solver, but it was based on OpenCV). WinAPI is fine, but cross platform would be better. It's okay if it uses a library, as long as it isn't dependent on it, meaning that I can switch to a different library with relative ease and the library is cross platform, free and nonunique (meaning that there are other free libraries out there that does the same thing).

Thanks,
ndrewxie
Last edited on Jul 12, 2017 at 6:27pm
Jul 12, 2017 at 7:57pm
A few years ago I had a ton of fun writing a sudoku solver in C++. The main solver uses a Board() class which can be initialized by an 81-character string. I have a Windows wrapper as well as an HP-50g hand-held calculator wrapper. The program has 4 or 5 different algorithms that advance the board toward a solution. Writing the algorithms is the fun part. The outer solver basically repeatedly applies the simplest algorithm until the board is solved or doesn't change. Then it applies the next more complex algorithm. If that changes the board, it goes back to the simple algorithm. If there is no change, it goes to the next more complex algorithm, etc. The most complex algorithm is a recursive solver: it makes an intelligent guess at an unsolved square and calls the main solver again.

The program uses classes, recursion, bitmaps and bit manipulation, function pointers and probably some other things I'm forgetting about. Give it a try!
Jul 12, 2017 at 10:26pm
Sure, @dhayden. I'll consider your idea and possibly an AI game player (connect 4 or checkers). By the way, how do you make a hand-held calculator wrapper?
Jul 13, 2017 at 12:12am
To name a few:

Tic-Tac-Toe using Minimax algorithm with alpha-beta pruning.
Nim using Minimax algorithm.
Travelling Salesman Problem using Hillclimb algorithm.
Queens problem.
A simple painting tool using WinAPI or OpenGL.
A* Algorithm.
Genetic Algorithm.
Steering behaviors.

EDIT: If you want to create a Sudoku solver, it might be beneficial to learn Lua as well and run your AI from a Lua script.
Last edited on Jul 13, 2017 at 12:15am
Jul 13, 2017 at 12:23am
I have gotten many game - based problems and purely algorithmic problems. Any practical project (meaning that you can use it on a day to day basis OR is very interesting)?
Jul 13, 2017 at 12:30am
I created a Dominoes game after reading user 'Unisaurus' request for help, and right now I'm adding in the ability for the computer to decide to use a specific Domino that gives him/her, more points. As it right now, the computer just plays the first domino it finds in its hand that can be legally placed, whether or not, it gets points. Even now, its fun to play, and I do it often.

EDIT..
Soon after writing the above, I finished giving the domino game its AI. Works great.
Last edited on Jul 13, 2017 at 2:46am
Jul 14, 2017 at 12:06pm
A very interesting project to work on AND useful in daily programming is a LinkedList class. It doesn't take too long to write, but it's very useful.
Jul 14, 2017 at 12:48pm
Writing a LinkedList is the best way to waste your time.
First the STL has one already and second they should not be used at all - according to B. Stroustrup.
https://www.youtube.com/watch?v=YQs6IC-vgmo
Jul 16, 2017 at 2:20pm
they should not be used at all

Not for that specific problem. By the way the video compares list and vector for doing random insertion and deletion from a sorted collection. In truth, neither one is appropriate for that problem.
Jul 16, 2017 at 5:40pm
What would you use a Linked List for ?
Jul 17, 2017 at 2:03am
Anything that requires insertion/deletion from the middle when you already have a reference/pointer to the item.

One case that comes immediately to mind from work is move-to-front to implement an LRU cache.
Jul 17, 2017 at 2:53am
> What would you use a Linked List for ?

The typical use-cases where std::list is indicated are:

a. We want to hold iterators or references to elements in the list, and these should not be invalidated unless the element itself is erased. (Addition, removal of other elements, or moving of elements either within the same list or across different lists should not invalidate externally held iterators and references.)

b. We need a strong exception guarantee for sequence modifying operations. If an exception is thrown (say, by the copy constructor of the fifth object) during an operation on the sequence, the state of the sequence should be rolled back to what it was just before the operation started.
More information: http://stroustrup.com/except.pdf
Jul 19, 2017 at 8:57am
First the STL has one already and second they should not be used at all - according to B. Stroustrup.


I will disagree with this and believe the snippet of his lecture is taken out of context. In a real world big ass server you don't have the luxury of allocating as much contiguous blocks of memory as desired. When that limitation hits you are going to get out of memory exceptions or have the os allocate you virtual memory (disk) which will be much, much slower than operating on the memory structures within a linked list.
Topic archived. No new replies allowed.