home *** CD-ROM | disk | FTP | other *** search
- Matrix
- Mini Life
- Form1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- Picture1
- MenuFile
- &File
- FileExit
- E&xit
- MenuRun
- &Restart
- Form_Click
- @ Form_Loadi
- Picture1
- Visible
- SumNeighbs
- SumNiegbs
- SumNieghbs
- ThenPicture1J
- SumNeights
- Form_Resize
- qbcolor
- backcolorW
- CurrentColor
- ifPicture14
- State
- Stete
- LifeState
- SumStates
- FileExit_Click
- MenuRun_Click
- Form_MouseDown
- Button
- Shift
- Form_Unload
- Cancel
- FileRun
- Enabled
- MenuRun
- Form_Resize
- FileExit_Click
- MenuRun_Click
- Turn 'em all off to make the initialization look plainer.u
- Set the cellular automata matrix to a random (50%) state of existence.
- The real action is here.
- The "Game of Life" rules are public domain.
- This Visual Basic adaptation by Rick Wagner (CIS 76427,2611) is given to the public by the author.
- Thanks to all the MSLANG Forum Visual Basic section who have uploaded code or given assistance
- through messages.e
- The form for this sample/demo was created with an 800 x 600 16 color machine. Please let me
- know if there are problems with the form at other resolutions. I know I have to redo forms
- for 8414/A because of 1) system fonts are different and 2) bitmaps are smaller. There area
- none of those in this sample, but I moved the project window over so VGA types can see it.
- This sample program exhibits all the classic forms of the "Game of Life:" blinkers, squares, etc.t
- Expanding the picture box array size and applying this code to it should work fine.n
- Note: To implement really large matrices you may find better performance in using a pair of 2D integer arrays to
- hold alternating state vectors for the matrix, one for the current generation, one for the next.g
- Using 2D matrices will make dealing with "ghost" cells easier.
- MenuRun.Enabled = -1 'Enables the "Restart" menu option
- Flag turns true when all cells are dead.
- Add some variety to the colors, and trace the loop visually.
- Lemme outta here... (otherwise you get a real secure system).a
- This loop establishes the sums of living neighbors for each cell
- and assigns future (next cycle) life states based on the "Game of Life" rules.
- A small (8 x 8) matrix implemented with a one dimensional control array.
- Initialize the sum of neighbors (non-border cells can have 8 neighbors).
- These conditions exclude nonexistent picture boxes.e
- Excludes from right column cells the touch of ghosts
- Exclude from left column cells the touch of ghosts
- Excludes from rights
- Excludes from left t
- Excldes from left
- Excludes from rights
- These are the "Game of Life" rules:
- This loop assigns visibility (aliveness) depending on states assigned above.
- Used to detect total death
- Sets the cell color for the current cycles
- They're all dead!"
- Form_Load
- Sets the cellular automata matrix to an initial random (50%) state of existence.
- Add some variety to the initial color
- Sets the cell color for the initial stateo
-