Monday, December 21, 2009

Keep on working

The problem I mentioned at the end of the last post I've already found a solution to - I had to JUST NAME the dependent class before describing the one depending on it.


Yesterday and today I kept working on the code. I realized that I get so much fun from the challange. Every problem I solve leads me to a next one. But only sometimes I feel frustrated - that's when I have no idea what is wrong. But when they are all a series of problems that I keep moving through (that doesn't mean that they're easy!!) then it all really does bring me joy (especially once I solve something particularly difficult ;) ).


Already yesterday I've started setting up the pieces on the board. It made me realize a problem which you might have noticed on the previous blog if you look at it carefully, but it was in fact very easy to overlook. The board I had was 7x7! I've digged through pretty much the entire code that I've wrote by now and finally realized my mistake. C++ in many cases counts from 0, not from 1. It is a rule I've remembered to watch out for, however once I got too mixed up when also using variables that I've subtracted 1 from them ending up with what I did. It can be thought of as if the board was moved up and left by one square so 1 column and 1 row got hidden behind the window border. I've fixed that by now as well as many other obstacles I met these two days and I have the board set up!







Now I will search for a solution to another problem - the pieces flick as if the program kept redrawing the board, than the pieces over it then the board again and so on.




UPDATE - found out the problem, it came from the fact that I am building the program slightly differently than I saw and practiced before. I needed a good description of a Windows message WM_PAINT and I found it easily on MSDN as well as more functions which let me solve the problem.


So now this stage is completely done and I can move on to the interaction stage - adding the implementation of functions that will let me move the pieces. Then algorithms that will serve as rules.

No comments:

Post a Comment