Advertisement
Gorgozoth

A0's Game of Life

Dec 13th, 2022
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. A0's Game of Life
  2.  
  3. The playing board is a grid of squares with dimensions x and y.
  4.  
  5. Cells (c) each occupy one starting square with coordinates (Xc, Yc).
  6.  
  7. Additional cells are differentiated with subscript numbers, starting with 1.
  8.  
  9. The number of cells n cannot exceed x * y.
  10.  
  11. Prior to seeding cells, each square on the grid is populated by a starting value v (this can be non-uniform if desired).
  12.  
  13. Every t units of time v += 1. (t is the rate at which value increases)
  14.  
  15. Every e units of time the v of (Xc, Yc) -= 1. (e is the rate at which cells eat value)
  16.  
  17. Every time unit, cells will take the mean value of the 5 squares adjacent to it in each of the 4 cardinal directions, Up, Down, Left, and Right. (Essentially a "[" shape with the cell at the center)
  18. The cell will move 1 unit in the direction of the highest mean value every unit of time after performing the above calculation.
  19. If 2 or more directions share the same mean value, the cell will perform a secondary calculation, wherein the directions that had equal values are assigned a number. Starting clockwise, the cell will then generate 2 * (the number of directions that tied) + 1 values (w). After generating these numbers, the cell will generate a new random number between 1 and w. Each direction will be allocated two of these numbers. After choosing a number, the cell will then move 1 unit in that direction.
  20. If the cell chooses w, the cell will wait on the square it is on for 1 additional unit of time.
  21.  
  22. If two cells contact each other along one face, 2 daughter cells will be created 2 squares diagonally away from each corner of the 2-cell-long rectangle. (There are 4 possible locations for the 2 daughter cells to be created, if the squares are not available, daughter cells will not be created)
  23.  
  24. Cells cannot reproduce for s time units after spawning. (this value is stored per-cell as a countdown Sc and is the time it takes cells to reach sexual maturity, 0).
  25.  
  26. Cells will consider other cells as having a v = 0 when performing calculations.
  27.  
  28. Cells will consider borders of the board as having a v = 0 as well.
  29.  
  30. If a cell decides the optimum move after touching another cell is inside of that same square and the other does not move, the cell that does not move will be killed (the cell ate its mate).
  31.  
  32. If a cell sits on a square with v = 0 for more than 4e, the cell will be removed (the cell starved to death).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement