Friday, April 4, 2008

Project Calendar - Starting the Pseudocode

With a very simple obstacle taken down earlier this week, I have written the very first part of what is going to be a very complex Pseudocode.

This is, so far, a very simple Pseudocode and the following algorithms (offset, calculation, dynamic generation, etc.) are all going to be built around this Pseudocode unless I'm working out a logic problem/challenge.

The Pseudocode only handles the logic for generating a predefined month that starts on a Sunday. There are no offsets or not calculations. I did add, however, an IF statement to check wether the current Cell-day is past 31, if so there can be a different handling, like changing the background color of empty cells.


ALGORITHM
A calendar-table generator. Currently with fixed month/year and no calculations.

CONSTANTS
...

VARIABLES
rowIndex : INTEGER : Row FOR Loop index
colIndex : INTEGER : Column FOR Loop index

currentDay : INTEGER : Variable representing the current Day/Cell.

LOGIC
LOOP FOR rowIndex FROM 0 to 6
LOOP FOR colIndex FROM 1 TO 7
currentDay ← colIndex + (rowIndex * 7)

IF currentDay <= 31 THEN
WRITE currentDay //inside cell
ELSE
WRITE "empty cell"
END LOOP
END LOOP

END