Commentary on Roger's and Lee's solutions to the "Game of Life" Both work. Both use cursor positioning calls. Roger's early solution did not. Use is not necessary (a fact that had not occurred to Lee!) Lee's program has some color, hiliting, beeping. Lee discovered the beep function works again after installing XP over Vista! Lee's has a menu feature. The data structure to support the grid is a 1-dimensional array of ints (Roger) chars (Lee). tiny-c does not have native 2-dimensional arrays so you have to turn row,col into row*dim+col where dim*dim is the dimension of the grid. There are advantages / disadvantages to both approaches; fewer bytes are used by chars, easier to copy one array into the other when chars are used (use strcpy instead of double for loop). How grid is populated varied; Roger uses random, Lee uses various (hardcoded "glider" and "blinker" etc.) Both of us discovered a limitation of ANSI.COM; window is limited to about a 50*50 grid. Lee's program shows generation and population displays; where to place the non-cell reporting was an issue. Both programs have logic to detect vanishing, static situation etc. Lee's program detects periodic situation. Lee discovered a freeware video screen capture program which is how the videos he posted were made. A very early idea that it would be cool to save and retrieve a grid was implemented in Lee's program. Roger's comment: "A cool exercise to say the least." My comment: Well done Roger. This was quite a challenging exercise to give at this stage of the tiny-c Programming Group. You are to be congratulated for solving it and solving it well. In closing, I think we need to sit back and enjoy Life.
|