Hard Light Productions Forums

Off-Topic Discussion => Programming => Topic started by: CommanderDJ on August 20, 2010, 09:59:23 am

Title: C++ Exercises?
Post by: CommanderDJ on August 20, 2010, 09:59:23 am
Can anyone link me to some good C++ exercises? I've found that I'm learning stuff pretty quick and I want to put my skills to the test. Thanks!

CommanderDJ
Title: Re: C++ Exercises?
Post by: Thaeris on August 20, 2010, 12:55:34 pm
http://www.cplusplus.com/

^Invaluable resource. Exercises? Learn I/O libraries to make a program spit out a text file - that's a great higher-level exercise to delve into. :)
Title: Re: C++ Exercises?
Post by: CommanderDJ on August 20, 2010, 07:07:15 pm
Thanks! I will get into that.
Title: Re: C++ Exercises?
Post by: The E on August 20, 2010, 07:53:09 pm
There's also this entry-level challenge on the SCP Mantis (http://scp.indiegames.us/mantis/view.php?id=2224).
Title: Re: C++ Exercises?
Post by: Spicious on August 20, 2010, 10:26:44 pm
You might find the attached interesting/challenging.

[attachment deleted by ninja]
Title: Re: C++ Exercises?
Post by: CommanderDJ on August 20, 2010, 11:01:35 pm
There's also this entry-level challenge on the SCP Mantis (http://scp.indiegames.us/mantis/view.php?id=2224).

What do you mean by entry-level challenge?

EDIT: Like, I get what it is, but does this have possible implications for future involvement for whoever solves it?
Title: Re: C++ Exercises?
Post by: The E on August 21, 2010, 05:18:44 am
Only if you want it to be. The point is that the solution for that problem is easy enought to implement for new guys.
Title: Re: C++ Exercises?
Post by: portej05 on August 23, 2010, 03:26:18 am
Coming from an engineering background, and having spent more time around CS students and algorithms competitions than I'd care to admit, I'd suggest that programming is only a small part of the puzzle.
A larger part of the puzzle is thinking about the algorithms that you're trying to implement.

http://uva.onlinejudge.org/ (http://uva.onlinejudge.org/) is a collection (and automated judging system) of problems from the ACM ICPC finals, and they do range in difficult from solve on an envelope to 'ask someone at Google'.

I suggest trying to work your way through them - you will learn more about programming by doing that than by just writing up classes that do very simple operations.
Title: Re: C++ Exercises?
Post by: Waistless on November 13, 2010, 07:37:18 pm
There's also this entry-level challenge on the SCP Mantis (http://scp.indiegames.us/mantis/view.php?id=2224).

I decided to give it a go, how does this look? (see attached alphacolors.zip, not sure how to create .diff or .patch in VC). In the UI white should change to black and blue should change to red.

As requested in mantis, it looks up colors.tbl and changes whatever colour specified. But you will need to specify all three colours if you do.
Some notes:


[attachment deleted by admin]
Title: Re: C++ Exercises?
Post by: karajorma on November 19, 2010, 11:47:58 pm
Didn't notice this until now. I'll take a look at it today.

EDIT : To be honest I'd have been tempted to move all the hardcoded colours to Def_Files. Not entirely sure about your string handling either. Might want someone more used to it to double check it too.
Title: Re: C++ Exercises?
Post by: Waistless on November 22, 2010, 02:57:58 am
Ok, well I was aiming to modify only one file (set by taylor in mantis). And I guess NUM_COLORS would also be better off in alphacolors.h anyway.  Ill make some changes as to what you suggested (didnt notice def_files before, still new to the fs code) Will edit this post when I'm finished making changes.

EDIT: Done. 3 files now changed: alphacolors.cpp, alphacolors.h, and def_files.cpp

Changes:

Unlike the previous solution its a bit less efficient (loops through the color_netplayer array for each entry in the default table). Does this matter too much?

[attachment deleted by admin]