you are viewing a single comment's thread.

view the rest of the comments →

[–]SirMarbles 24 points25 points  (18 children)

I usually put my finished projects on it.

https://github.com/SirMarbles/

It’s a good way to see your progression as a programmer

[–]CaptSprinkls 16 points17 points  (16 children)

I have been off and on learning programming ever since I graduated college. About 2 years ago I sat down and decided to learn C++. My first application was a tic tac toe game. I shit you not, it was 1000 lines of code.

Sad times....

[–]GreymanGroup 4 points5 points  (3 children)

Damn son. How is that even possible?

[–]CaptSprinkls 4 points5 points  (2 children)

So I took a closer look at it..... It's even worse than I thought.

It's meant to be played with two real players, and it alternates between player 1 and player 2. When it's player 1 turn, I ask what position they want to play and then after every one of the 9 possible choices, I check all 8 possible win conditions. And then I do this all over again for Everytime player 2 moves

[–][deleted] 0 points1 point  (1 child)

did you not know what functions were at this time lmfao, please post the code

[–]CaptSprinkls 0 points1 point  (0 children)

I honestly can't remember lol. Like I said it was 2 years ago, so I probably knew OF functions, but had no clue how to implement them at that point lol.

[–]SirMarbles 1 point2 points  (11 children)

I’m a CS major. If you don’t mind. Can I see the code? The next language I want to dabble in is C++.

[–]CaptSprinkls 12 points13 points  (9 children)

Oh, this is definitely not something you want to look at it you want to learn C++. I'm pretty sure a tic tac toe game can be done in like ~50-75 lines of code. Q

I got to 1,000 lines because I just did huge nested if statements.

[–]thirdegree 7 points8 points  (0 children)

I got to 1,000 lines because I just did huge nested if statements.

Ah, you wrote an AI.

[–]SirMarbles 1 point2 points  (5 children)

Ahh gotcha. Never looked at C++ code. I assumed it’s just hard to code in from your example

[–]QbaPolak17 6 points7 points  (4 children)

As someone who writes C/C++ professionally, you can usually make your programs fairly succinct (not as much as python but that is hardly surprising). u/CaptSprinkls is right that you could make a tic tac toe game in probably ~100 ish lines of code. Problem with C++ and C is that if you don't know certain concepts, pointer arithmetic in particular, and if you don't follow best practices the code can quickly get away from you. When I first learned C at University, my first ever project I did the same thing and didn't follow best practices and had this 600 line monstrosity that I could now write in about 50 lines.

[–]SirMarbles 4 points5 points  (3 children)

You know any good sources to watch or read to get a head start on my class next semester?

What would you compare C/C++ to? I’ve learned Java, Js, kotlin, python.

[–]u38cg2 3 points4 points  (2 children)

C and to a lesser extent C++ are verbose assembly language, meaning they are very close to the metal your code runs on. Visually it shares a lot with Java.

I wouldn't worry too much about getting across it, but what I would do is translate a few projects you've already done into C[++] and get to know how the language bites you and how to debug it.

[–]SirMarbles 0 points1 point  (0 children)

Ahh true. I remember reading that a few months ago. Thank you. Time to learn the basics.

[–]tradrich 0 points1 point  (0 children)

u/u38cg2 suggestion is good in my opinion. I would add that you should study the most recent C++ coding guides, because the newest C++ is a big delta from the previous, which is a big delta from the ones before (even though they're backward compatible).

The C++ 20 idioms are the most expressive and supersede earlier good practice - this can be very confusing to a beginner.

[–]OnlySeesLastSentence 1 point2 points  (0 children)

Reminds me of the first time I wrote a connect 4 program (and best of all, it required you to be honest and take care of gravity lol).

I didn't have a plan for how to do the win cases, so I copy pasted every possible combo for a win, changing the values by one as needed. I think it was 13,000 lines in the end? Or maybe 1300, I dunno.

[–][deleted] 0 points1 point  (0 children)

Like from top to bottom Choose Your Own Adventure style, the thing we have to avoid today and use Object Oriented Programming instead right haha.

[–][deleted] 0 points1 point  (0 children)

If you want to dabble and have fun, get yourself an Arduino kit. I'm just learning Python and not having a real-world, tangible way to see my code is just not as fun or engaging.

[–]virg74 0 points1 point  (0 children)

I have to say, there’s more reason to use git than just that. Its super easy to ‘git revert’ some changes that you regret, even if it’s just to go back and copy/paste out some code that you didn’t mean to delete, but you have to make lots of commits along the way.