Hello gamedev! (the irony!)
Thank you for having on the forums and thank you for taking your time reading my first post!
Background
Get this: I hated math, did horribly in school and high-school and never got along with it. I always considered myself to be more of a humanist (if that's how it's called) - I loved studying other languages (self thought myself English and German of which I'm proud, they might not be native level, but I'm content), philosophy, learning history and ultimately I finished law in the university.
At the end of the day I sort of started thinking that some humans are more math/precise science proficient, while others find themselves on the opposite spectrum (whatever that is).
Shortly put: I have a very limited math knowledge.
Reason
Maybe it was because the constraint to learn was set aside, and my curiosity set in for something I didn't understand for a long time (as a side note I'm 25 years old). I thought programming can make me a bit more of a whole person, and reconcile with something I disliked, and so, slowly I gained more and more interest on this subject, on to the point where I started learning c++ by my own about one week ago. Before learning about arrays, I wrote this in c++:
[spoiler]
#include "stdafx.h"
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int main()
{
/*
int mode;
cout << "Would you like to play with a friend, or against the computer?\n";
cout << "1. With a friend\n2. Against the computer\n";
cin >> mode;
system("CLS");
*/
char plc1 = 255;
char plc2 = 255;
char plc3 = 255;
char plc4 = 255;
char plc5 = 255;
char plc6 = 255;
char plc7 = 255;
char plc9 = 255;
char plc8 = 255;
char plcTot = plc1 + plc2 + plc3 + plc4 + plc5 + plc6 + plc7 + plc8 + plc9;
while (true)
{
cout << endl << endl << endl << endl;
cout << "\t-------------------------\n";
for (int x = 0; x < 9; x++)
{
if (x == 3 || x == 6)
{
cout << "\t------------------------- ---------------------\n";
}
if (x == 1)
{
cout << "\t| " << plc1 << " | " << plc2 << " | " << plc3 << " | 1 | 2 | 3" << endl;
}
else if (x == 4)
{
cout << "\t| " << plc4 << " | " << plc5 << " | " << plc6 << " | 4 | 5 | 6" << endl;
}
else if (x == 7)
{
cout << "\t| " << plc7 << " | " << plc8 << " | " << plc9 << " | 7 | 8 | 9" << endl;
}
else
cout << "\t| | | | | |" << endl;
}
cout << "\t-------------------------\n";
if (plc1 + plc2 + plc3 == 237 || plc1 + plc4 + plc7 == 237 || plc3 + plc6 + plc9 == 237 || plc7 + plc8 + plc9 == 237 || plc3 + plc5 + plc7 == 237 || plc1 + plc5 + plc9 == 237 || plc4 + plc5 + plc6 == 237 || plc2 + plc5 + plc8 == 237)
{
cout << "O wins!\n";
break;
}
if (plc1 != -1 && plc2 != -1 && plc3 != -1 && plc4 != -1 && plc5 != -1 && plc6 != -1 && plc7 != -1 && plc9 != -1 && plc8 != -1)
{
cout << "It's a draw!\n";
break;
}
int plaX;
int plaO;
cout << "\nX's turn: ";
cin >> plaX;
switch (plaX)
{
case 1:
plc1 = 88;
break;
case 2:
plc2 = 88;
break;
case 3:
plc3 = 88;
break;
case 4:
plc4 = 88;
break;
case 5:
plc5 = 88;
break;
case 6:
plc6 = 88;
break;
case 7:
plc7 = 88;
break;
case 8:
plc8 = 88;
break;
case 9:
plc9 = 88;
break;
}
system("CLS");
//////////////////////////////////////////////////////////////////////
cout << endl << endl << endl << endl;
cout << "\t-------------------------\n";
for (int x = 0; x < 9; x++)
{
if (x == 3 || x == 6)
{
cout << "\t------------------------- ---------------------\n";
}
if (x == 1)
{
cout << "\t| " << plc1 << " | " << plc2 << " | " << plc3 << " | 1 | 2 | 3" << endl;
}
else if (x == 4)
{
cout << "\t| " << plc4 << " | " << plc5 << " | " << plc6 << " | 4 | 5 | 6" << endl;
}
else if (x == 7)
{
cout << "\t| " << plc7 << " | " << plc8 << " | " << plc9 << " | 7 | 8 | 9" << endl;
}
else
cout << "\t| | | | | |" << endl;
}
cout << "\t-------------------------\n";
if (plc1 + plc2 + plc3 == 264 || plc1 + plc4 + plc7 == 264 || plc3 + plc6 + plc9 == 264 || plc7 + plc8 + plc9 == 264 || plc3 + plc5 + plc7 == 264 || plc1 + plc5 + plc9 == 264 || plc4 + plc5 + plc6 == 264 || plc2 + plc5 + plc8 == 264)
{
cout << "X wins!\n";
break;
}
//////////////////////////////////////////////////////////////////
// if (mode == 1)
//{
cout << "\nO's turn: ";
cin >> plaO;
system("CLS");
switch (plaO)
{
case 1:
plc1 = 79;
break;
case 2:
plc2 = 79;
break;
case 3:
plc3 = 79;
break;
case 4:
plc4 = 79;
break;
case 5:
plc5 = 79;
break;
case 6:
plc6 = 79;
break;
case 7:
plc7 = 79;
break;
case 8:
plc8 = 79;
break;
case 9:
plc9 = 79;
break;
}
// }
/*
else if (mode == 2)
{
if (plc9 = 88 )
plc5 = 79;
system("CLS");
}
*/
}
cin.get();
cin.ignore();
return 0;
}
[/spoiler]
I know a lot of people advised against learning c++ as a first language, but this is exactly I'm searching for - a challenge in terms of self discipline for the mind, learning new concepts to play with and interact. As the title says, it's not the complexity that scares me, it's the fact that I feel I have a total false approach on how I'm thinking. This book that I'm reading (jumping into c++) is indeed teaching me how to code (syntax and all), but it doesn't teach how to become more structured or coherent in your code.
My objective and final question
I want to program to keep in mental shape and to explore a totally new world for me, and in the same time have fun. I enjoyed writing the tic tac toe game. It was a revelation for me on how even a simple game can work. Personally I enjoy roguelike type of games very much (Dwarf fortress, rogue survivor, FTL, IVAN, Incursion, Liberal Crime Squad etc.) and I would look forward to develop some simple games like this to begin with - this being said, I don't fancy super graphics and all for practical purposes.
My question: How can I learn to be more concise in coding and to think more logical ? To properly implement whatever simple or complicated idea into code ? I'm the kind of person that believes in results by practice but the problem is I don't know what to practice. Sure I can continue coding and learning new "tools" that I can use, but I'm afraid I'm developing (or rather, I already have) a very messy method of approach. Would reading lecture on theory of coding help in this case ? Or maybe, going back, way back into the basics would help me understand the present better ? Like learning assembly code and how it works ? Or learning C ?
I plan to take this learning process slowly, constant and systematic, so I do not feel like there is a rush - I want to enjoy the ride, even if there are no immediate results to experience.
Again, thank you for your time reading this and I'm looking forward to read any post that lands on my topic!
Bonus question:
[spoiler]
Anyone who cares to join this discussion could also write at the end of his post, the answer to this question of which I am greatly interested:
"Do you think we are divided between leftists and rightists thinkers? just as well as we are left handed or right handed?"
[/spoiler]