Game of Life 2D and 3D

REPO: repository
Hosted Live: hosted live
2D Mode
Press 1 to toggle 2D mode (default mode).
In this mode, you can click and place cells.
Press enter to begin the simulation after the cells are placed.
Press c anytime to stop a run or clear the board.
Press r to create a random starting state and begin running the simulation.
3D Mode
Press 2 to toggle 3D mode.
This does not support manual cell placement.
Press r to create a random starting state and begin the simulation.
Press c to clear a solution or stop a running simulation.
3D mode uses 4 different life and death rules that can be toggle by pressing 6,7, 8, or 9 prior to hitting r

4 Likes

I usually put a double click for the selection of user input because one click is usually used for the controller !!

like in a case when I am dragging your world, at the end I get that mouse position selected !!

since in your case, double click can be annoying when the major task is clicking itself !!

1 Like

Great point Pravin! This is true, if you are clicking and dragging and you release with your cursor intersecting over the board a cell will be placed. An interesting problem. I wonder if arrow key input would be a better way to rotate the world instead of clicking and dragging!

Keep the click + drag. You can easily detect if the user has been dragging by keeping track of the mouse movement while the left button is held down. If it moved too much after the mouse-up event has fired, simply ignore the click. The exact same trick can be implemented for touch devices using the touch-start and touch-end events.

1 Like

Thanks for the message Harold. I will have to look into implementing this!