====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
gibson:teaching:fall-2013:math445:lab10 [2013/11/13 14:10] gibson |
gibson:teaching:fall-2013:math445:lab10 [2013/11/13 14:19] (current) gibson |
||
---|---|---|---|
Line 7: | Line 7: | ||
Do the boundary conditions make the domain effectively infinite? Why or why not? | Do the boundary conditions make the domain effectively infinite? Why or why not? | ||
- | **2.** We are going to create our own code for the game of life and use a | + | **2.** Write your own Game of Life code as a Matlab function, following these steps. |
- | different approach based that does not allow anything to live on | + | Open the file ''mylife.m'' and start enter these lines. |
- | borders of the domain. We will let our board be 50x50 grid. Start a | + | |
- | new script file, and start it with the lines | + | |
<code> | <code> | ||
Line 20: | Line 18: | ||
of the code? | of the code? | ||
- | **3.** Next set up the initial layout for the game of life. This initial | + | **3.** Next set up the initial layout for the game of life on a |
- | condition leads to some pretty interesting behavior! | + | a 50 x 50 grid. This initial condition leads to some pretty interesting behavior! |
<code> | <code> | ||
Line 49: | Line 47: | ||
spy(X,'bs'); | spy(X,'bs'); | ||
- | |||
A more complicated but ultimately more satisfying way to plot the live cells | A more complicated but ultimately more satisfying way to plot the live cells | ||
Line 62: | Line 59: | ||
</code> | </code> | ||
- | Whatever method you use, follow it with this code | + | Use this latter code unless you can't get your Game of Life code to run correctly. |
+ | In that case, use the simpler ''spy'' plotting code to debug, and then replace it | ||
+ | with ''find'' and ''plot'' once your code is running correctly. | ||
<code> | <code> | ||
Line 72: | Line 71: | ||
</code> | </code> | ||
- | Please briefly describe what each line of your code does. Use the ''help'' function or menu | + | Please briefly describe what each line of your code does. Use the ''help'' |
- | if you're not sure. | + | function or menu if you're not sure. |
You may want to change the value of ''MarkerSize'' to make your plots look | You may want to change the value of ''MarkerSize'' to make your plots look | ||
better, or change the argument of the ''pause'' function to make the code | better, or change the argument of the ''pause'' function to make the code | ||
Line 138: | Line 137: | ||
- | Turn in your completed code and the answers to the above questions. | + | Turn in your completed code ''mylife.m'' and ''mylife2.m'' codes and the answers to the above questions. |