I’ve been implementing this little game idea, which is (somehow?) similar to Conway’s Game of Life:
0) You have a matrix of colored dots (RGB values)
1) If the adjacent cell has a lower X value than your Y, put Y = 0 on that cell
(Where X and Y are Red || Green || Blue)
2) Red beats Green beats Blue beats Red
What I’m doing now it’s just going cell by cell, checking if the above rules are met. However, the behavior it’s not quite what I intended since sometimes cells on the first rows have advantage over those at the ending rows.
Can multithreading prevent this (say, launching two threads, one initiating in the first cell and the other on the last one)? Please pardon my ignorance on concurrency, but I felt this was a nice way to begin working with it.
My guess is that you are updating the matrix inplace, whereas you should copy keep a track of the old state of the matrix, updating a new one, then replacing the original one by the updated.
This way, you won’t update some cells, then on the next line test their values.
Thus, it would be an algorithm problem, not related with programmation (and therefore multithreading cannot help).