I think that a computer program to teach C++ can be more efficient than a book to teach the language.
The advantage of a program is that you do not have something static
and the program can ask the user questions to see if the user understand or remember and simply go back to repeat previous explanations if the user does not give a correct reply.
Today my knowledge of the C++ language is not enough to understand code like the stockfish's code.
I have a book but I did not read most of it and I prefer learning from a computer program in case that it is possible.
Uri
I wonder if there is a computer program to teach C++
Moderator: Ras
-
- Posts: 10890
- Joined: Thu Mar 09, 2006 12:37 am
- Location: Tel-Aviv Israel
-
- Posts: 718
- Joined: Fri Mar 20, 2009 8:59 pm
Re: I wonder if there is a computer program to teach C++
I learn a language by looking at source code and writing source code. I don't think there's much of a shortcut to be had...
-
- Posts: 859
- Joined: Mon Aug 10, 2009 10:05 pm
- Location: Italy
- Full name: Stefano Gemma
Re: I wonder if there is a computer program to teach C++
I think that a good C++ forum could be the best way to help you learning C++ language. I would proceed that way:
- inspect the source code you are studying until you find something that it is hard to understand
- post in the forum (or maybe even here, if it is not considered off-topic) a question about what the think that blocked you would means
- discuss about the answers givene and try to find some sample or more information about that
Step by step, you can learn all what you need to understand the C++ program that you're interested to.
- inspect the source code you are studying until you find something that it is hard to understand
- post in the forum (or maybe even here, if it is not considered off-topic) a question about what the think that blocked you would means
- discuss about the answers givene and try to find some sample or more information about that
Step by step, you can learn all what you need to understand the C++ program that you're interested to.
-
- Posts: 12792
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: I wonder if there is a computer program to teach C++
The best way to learn is to take a class from a good teacher who is skilled at the language.Uri Blass wrote:I think that a computer program to teach C++ can be more efficient than a book to teach the language.
The advantage of a program is that you do not have something static
and the program can ask the user questions to see if the user understand or remember and simply go back to repeat previous explanations if the user does not give a correct reply.
Today my knowledge of the C++ language is not enough to understand code like the stockfish's code.
I have a book but I did not read most of it and I prefer learning from a computer program in case that it is possible.
Uri
If you read Stroustrup's book, that is a good start. Then try the ideas yourself.
-
- Posts: 2684
- Joined: Sat Jun 14, 2008 9:17 pm
Re: I wonder if there is a computer program to teach C++
To understand Stockfish's code you just need to know about 10% of the whole C++Uri Blass wrote: Today my knowledge of the C++ language is not enough to understand code like the stockfish's code.
Apart from ver very few exceptions I almost use very basic concepts and we try to keep it as simple as possible. It is a choice.
If there is some point or some function that is not clear to you , please drop me an email, I will be glad to help you. If some parts of the code are not clear I will try to rewrite in a better way. It is important to have feedback from peers, because for me it is too easy to overlook some not clear part .
And for us to develop easy to read code is of paramount importance, more then ELO gains.
Marco
-
- Posts: 10890
- Joined: Thu Mar 09, 2006 12:37 am
- Location: Tel-Aviv Israel
Re: I wonder if there is a computer program to teach C++
Thanks but I do not like to ask basic questions that are not because of code that is not clear to programmers but because of the fact that I do not know the language.mcostalba wrote:To understand Stockfish's code you just need to know about 10% of the whole C++Uri Blass wrote: Today my knowledge of the C++ language is not enough to understand code like the stockfish's code.
Apart from ver very few exceptions I almost use very basic concepts and we try to keep it as simple as possible. It is a choice.
If there is some point or some function that is not clear to you , please drop me an email, I will be glad to help you. If some parts of the code are not clear I will try to rewrite in a better way. It is important to have feedback from peers, because for me it is too easy to overlook some not clear part .
And for us to develop easy to read code is of paramount importance, more then ELO gains.
Marco
There are probably basic things that I do not know about C++
For example I see that stockfish is often using the word operator and I simply do not know how this word is used in the language(I only understand that it is basically something that alllow me to use functions in in a different way and instead of writing something like
c=plus(a,b); that I can write c=a+b;(assuming that a,b are some structures like complex numbers so special function is needed to add them).
Maybe it is going to be good if I read and undersatd chapters 8 and 9 of the following site
http://www.learncpp.com/
-
- Posts: 2684
- Joined: Sat Jun 14, 2008 9:17 pm
Re: I wonder if there is a computer program to teach C++
Uri Blass wrote: There are probably basic things that I do not know about C++
For example I see that stockfish is often using the word operator and I simply do not know how this word is used in the language(I only understand that it is basically something that alllow me to use functions in in a different way and instead of writing something like
c=plus(a,b); that I can write c=a+b;(assuming that a,b are some structures like complex numbers so special function is needed to add them).
Yes, as examle in SF is defined the following comparison '<' operator:
Code: Select all
bool operator<(const MoveStack& f, const MoveStack& s) { return s.score < f.score; }
Code: Select all
struct MoveStack {
Move move;
int score;
};
The "secret" is stunning simple: std::sort() is written in the most natural form, it has statements of the kind
Code: Select all
if (firstObj < secondObj) { .... do something... }
This is a very powerful and elegant general solution used very often: the standard library contains a collection of algorithms not tied to a specific type, but can be used with any type. The programmer when uses an STL algorithm writes also the specific comparison operators that the C++ compiler silently will substitute inside the STL function during compilation. So we have completely disjointed the algorithm (inside STL) from the actual data it will going to operate (defined by the programmer).
I have said that std::sort() sorts in ascending order, but we need a sorting in descending order so that highest scored moves are the first. Here the trick is very simple as you can see from the comment to the operator<():
Code: Select all
// Note that operator< is set up such that sorting will be in descending order
inline bool operator<(const MoveStack& f, const MoveStack& s) { return s.score < f.score; }
A good and easy to read on-line book that can ba also free downloaded as pdf is Thinking in C++Uri Blass wrote: Maybe it is going to be good if I read and understand chapters 8 and 9 of the following site
http://www.learncpp.com/
http://www.mindview.net/Books/TICPP/Thi ... CPP2e.html