Let me start by saying this is probably a stupid question..
I've made a chess program in C++ in which you can play against the AI at a very basic, rudimentary, level. It's working fairly fine and all but the problem is I don't know how to make the display on my screen change.. actively. I'm not sure how to explain what I mean by this, so let me just give you an example.
I keep the board saved in a char a[100][100] and the program prints the board, then asks for the user's input for the move. Then does: for(int i=1;i<=60;i++) cout<<endl;
and then (after the AI has made his move) prints the board again.
My question would be: can you avoid printing 100 blank lines? Can you just change the current display on the screen? Can you "overwrite it", so to say?
This hasn't bothered me too much with the chess program but now I'm trying to make a "Game of Life" and I sort of need the display on my screen to change actively. I'm using the console for display by the way, I'm not using any form of graphical interface.
Again, this may be a stupid question, but help would be appreciated nontheless.
Yes, there is. Unfortunately, you'll have to resort to the likes of the WinAPI or curses or something to be able to do so - C++ doesn't guarantee that the machine will even have a screen, so there are no functions for this. You can probably find examples of how to do this on MSDN or the documentation (for WinAPI and curses, respectively).
As for your clear screen method, something that could be much faster (with less flicker) is something like this:
std::cout << std::string(60, '\n');
This is because std::endl will also flush the buffer, but you don't need (or want) this to happen for printing blank lines so as to clear the screen, so instead you can just print a string containing 60 newlines.
Don't use NCurses, use the WinAPI. NCurses is all or nothing, and I found I did not want to be forced to use windows, and NCurses' getch(), etc.... It was irritating.