Assuming a pixel grid with x and y of the size 1000 over 1000. In each iteration\run, using a random number generator, certain cells will be marked as occupied. Those cells will be written in a SQLite database.
In a two dimentional grid, each cell can have up to 8 occupied neighbours. Once an occupied cell sees 8 occupied neighbours i would like to preform some computations.
At the moment i have in my SQLite table three columns (x and y, processed). Only occupied cells are written in to the table (unoccupied cells are not in the table). The processed flag is a boolean flag.
I would like to know after each run, if there exist cells which are occupied, not processed and have 8 occupied neighbours. I am open to changes in the database for doing this query.