2006-03-28

The big part of Poggle

At least the part that I consider the MAIN part, everything else is secondary.

Step 13: Firat of, the mod portion of the program, int changeState(const int& state), the only thing that this routine does is to return the next integet in the current cycle.

The pre-condition is that the current Board instance is valid.

If the state parameter of the function is equal to the Board class's cycle variable -1, then return 0 (the starting point).

Otherwise, return the state +1.

Step 14: For void toggleCells(const int& index);
The pre-conditions are tha the Board instance is valid (again).
That the the place index is within bounds. (Release, otherwise just return.)
And that the states array is not NULL

First off, the clicked CRect element. Use the changeState() function on the state for the clicked CRect.

If the index is greater than the Board's size-1 (top row), then apply changeState() to the CRect above the current cell. (index - Board's size)
If the index is less than or equal to Board's size * (Board's size) (bottom row), than apply changeState() to the CRect below the current cell. (index +Board's size).
If the index mod() with the Board's size is NOT equal to 0 ( left side), apply changeState() to index -1.
If the index mod() the Board's size is NOT equal to the Board's size -1 (right side), then apply changeState() to index +1.

No comments: