-
Notifications
You must be signed in to change notification settings - Fork 1
Clojure implementation of "Conway's Game of Life" showing parallelization of the work. See http://groups.google.com/group/clojure/msg/73df9c3446bf092f for background. Thanks to Larry Sherrill for initial implementation: http://lpsherrill.blogspot.com/2009/02/conways-game-of-life.html
sfraser/MultithreadedGameOfLife
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This program runs 1 to many Game of Life simulations. For more on the "Game of Life", see: http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life This code uses clojure concurrency primitives to demonstrate how threads can be used to get more done in less time. The more cores you have, the more effective a demonstration. Each window this program opens has it's own set of threads to execute the simulation. By watching a window with 1 thread versus a window with 2, 3, or 4, you will visually see the power of parallelizing CPU intensive work. At the start of the simulation each window starts out with the same "state". When you hit the Start button (on any window), all the windows will start running the Game of Life. Each thread will use a specific color so that you can visually see the parallelism of the process. The windows are assigned an increasing number of threads from 1 to the total number of windows opened. So if you ask for 3 windows, you will get one window with 1 thread, another with 2 threads, and a third with 3. There is a "total frames" and a "frames per second" indicator on each window so you can also get a rough feel for how fast each window is running. How to Run At the top of the file set these vars: ; Dimensions of the grid - make this bigger if you have more horsepower! (def x-cells ( * 32 2)) (def y-cells ( * 48 2)) ; Size in pixels of the squares we will paint on the screen - make this smaller with larger size grids (def cell-size 5) Then call -main with the following params: * number of windows you want to see
About
Clojure implementation of "Conway's Game of Life" showing parallelization of the work. See http://groups.google.com/group/clojure/msg/73df9c3446bf092f for background. Thanks to Larry Sherrill for initial implementation: http://lpsherrill.blogspot.com/2009/02/conways-game-of-life.html
Resources
Stars
Watchers
Forks
Releases
No releases published