Star Clusters - optimizing The Game of Life

429 vues
Accéder directement au premier message non lu

Scott Ferguson

non lue,
8 juil. 2015, 10:29:5408/07/2015
à app-inventor-de...@googlegroups.com


This project follows an earlier one in which I used the Canvas DrawCircle block to fill circles in a grid.
The problem with that algorithm was that every grid space was scanned to  determine whether it should be filled or erased.
That means that the larger the grid the slower the updates to the screen.

The algorithm used in this project uses an optimization that only looks at the active 'stars' on the grid 'space' and their immediate surrounding spaces.
In addition, if a star's location is already in one of the lists that tracks active stars it only needs to be scanned one time.

The user can create patterns with this project and maintain a list of their favorite patterns.
Popular patterns can be found here by clicking the category links on the upper right of the page: http://www.conwaylife.com/wiki/Main_Page
Adding a new pattern to the favorites list in the app is as easy as touching the screen to add and remove stars in the pattern until you get it right, giving the pattern a name and touching the add-to-favorites icon.
The new pattern will appear at the top of the favorites list.

You also can add to the built-in ListPicker of patterns which you will find in the GameSCR.Initialize event block.

See attached project.

Try:
8 stars in a vertical line

---
hAPPy INVENTORing!
StarClusters.aia
StarClusters.apk
Répondre à tous
Répondre à l'auteur
Transférer
0 nouveau message