As I start to code more and more, for example in C++, I tend to also want to learn more about the accepted standards for code.
I'm trying to code a chess engine right now, but I'm unsure how to treat each 'module' of the program (which is separated into different files).
For example, it makes sense to make a class for bitboards as
bitboard.cpp, as this might be required later on. But, it doesn't make sense to have a class for the move generator, because I won't ever need more than one move generator.
But I still want to abide by the principle of least privilege, and not give users access to more functions than necessary. But, I'm not sure if you can do this without a class? I've looked at
namespace but I'm not sure how it'd apply in this case.
How do professional programmers handle this sort of thing? I've looked at the source for the Stockfish open source chess engine, and it has both header files and cpp files, but the header files simply seem to have a whole bunch of variables.