@@ -1,5 +1,5 @@
11---
2−sort: 3
2+sort: 5
33comments: true
44---
55
@@ -25,23 +25,23 @@ space.
2525 ##.
2626
2727
28−1. Write a function that takes nine loobean inputs, `nw`, `nc`,
29− `ne`, `cw`, `cc`, `ce`, `sw`, `sc`, and `se`. Produce 'yes'
30− if the center space will be alive in the next generation and
31− 'no' if it will be dead.
28+1. Write a function `next-generation` that takes nine loobean
29+ inputs, `nw`, `nc`, `ne`, `cw`, `cc`, `ce`, `sw`, `sc`, and
30+ `se`. Produce 'yes' if the center space will be alive in the
31+ next generation and 'no' if it will be dead.
3232
33−1. Write a function that takes an integer `n` and produces an
34− `n` by `n` grid of loobeans, (hereafter, "board"),
35− initialized to 'no'. This grid should be represented as a
36− list of `n` lists of length `n`.
33+1. Write a function `create-board` that takes an integer `n` and
34+ produces an `n` by `n` grid of loobeans, (hereafter,
35+ "board"), initialized to 'no'. This grid should be
36+ represented as a list of `n` lists of length `n`.
3737
38−1. Write a function that takes a board, a row index, and a
39− column index, and produces a new board, identical to the old
40− except that the state of the space referred to by the row and
41− column indices has been toggled.
38+1. Write a function `toggle-space` that takes a board, a row
39+ index, and a column index, and produces a new board,
40+ identical to the old except that the state of the space
41+ referred to by the row and column indices has been toggled.
4242
43−1. Use the following function to pretty-print the board. For
44− bonus points, try to follow what it's doing.
43+1. Use the following function `print-board` to pretty-print the
44+ board. For bonus points, try to follow what it's doing.
4545
4646 ```
4747 :: XX test
@@ -85,8 +85,8 @@ space.
8585 . . . . . . . . . .
8686 ```
8787
88−1. Write a function that iterates every space on the board.
89− Print out the new board. It should look like this:
88+1. Write a function `step` that iterates every space on the
89+ board. Print out the new board. It should look like this:
9090
9191 ```
9292 . . . . . . . . . .
@@ -104,14 +104,17 @@ space.
104104 > Note that the spaces on the edge don't have the full nine
105105 > neighbors. For now, assume that they're always dead.
106106
107−1. Write a function that runs the above function `n` times on
108− the board. Observe the board as the game progresses.
109− Congratulations, you've written Conway's Game of Life in
110− Hoon!
107+1. Write a function `life` that runs the above function `n`
108+ times on the board. Observe the board as the game
109+ progresses. Congratulations, you've written Conway's Game of
110+ Life in Hoon!
111111
1121121. One common way to handle the edge of the board is to pretend
113113 that it "wraps around", forming a torus. In other words, say
114114 that the spaces on the left edge of the map are adjacent to
115115 the ones on the right edge, and the spaces on the top edge
116− are adjacent to the spaces on the bottom edge. Pay special
117− attention to the corners.
116+ are adjacent to the spaces on the bottom edge. Modify `step`
117+ to act this way. Pay special attention to the corners.
118+
119+1. Modify `create-board` to use `++og` to randomly initialize
120+ the board with live or dead spaces.