You check every space within the playing field before you refresh the screen. The original spaces that you would check that are in a corner or on the edge of the playing field are at a disadvantage due to less number of spaces surrounding them. Like wise, if there are four or more dots in total around the original space with a dot that original dot will also cease to exist due to overcrowding. If there are zero or one dots in all the surrounding spaces then the original dot will cease to be a dot and will become an empty space due to starvation. If there are two or three dots the dot in that original space will continue to be a dot. Add up all of the dots around the space in question. As I understand it, for every space on the screen, if there is already a dot in place in that space then you would look at the eight adjoining, or touching, spaces around the space in question. Some just give the premise and others offer code snippets. There are lots of web pages describing Conway’s Game of Life. This way the person will know that B to exit and LEFT to reset will only happen once the program is running. I think I need to add a line above the bottom two lines that should say, “While running press:”. After I got those pictures loaded into the computer and looked at the screen shot of the badge I see a change I’d like to make. I haven’t taken out the “inefficient” delay loop out of the Game Of Life program, yet, but I am ready to document the story so far. To get the program running at about the desired speed I had the little section in the MAIN loop running once every 50,000 times. Once I had the buttons example running I decided to try to get rid of the “inefficient” delay. Whomever came up with the default code examples for the badge included the “inefficient” delay. All of the examples for checking on button presses included this little bit of code that could cause a delay. I ended up writing a little demo program to make sure I had the coding of the buttons correct. I thought I was finally done and I decided to add a restart button. The code began to look ugly, but it worked. ANDs and ORs were not cooperating so I separated them out into their own IF statements. I really hadn’t programmed in a variant of C like this in a while. Every time I thought I was about finished I would think of adding something else and end up breaking something different. As a project for me to work on I decided to try coding in C Conway’s Game Of Life on the SuperCon Badge.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |