Commit 67fab092 authored by Peter Fidelman's avatar Peter Fidelman
Browse files

Fix readme typo

parent 07e68e19
......@@ -143,10 +143,10 @@ Finally, the data structures I am using are extremely simple:
## Part A
The trick here is the boundary behavior -- trying to read off the edge of the board should be treated exactly the same as reading a '9'.
2-D indexing is a huge pain in Forth, so I wanted a simpler way to track the board edges. Here's what I sound up doing.
2-D indexing is a huge pain in Forth, so I wanted a simpler way to track the board edges. Here's what I wound up doing.
- **For the left and right edges** - When reading input, pad each line with a leading '9'. The empty line at the end of input also counts as a "line" so the effect of this logic is to '9'-delimit the input lines and the first and last character of the board will both wind up as '9's too.
- **For the top and bottom edges** - Clamp out-of-range addresses to first or last character of board, which are now guaranteed to be 9's.
- **For the left and right edges** - When reading input, pad each line with a leading '9'. The empty line at the end of input also counts as a "line" so the effect of this logic is to '9'-delimit the input lines and the first and last character of the board both wind up as '9's too.
- **For the top and bottom edges** - Clamp out-of-range addresses to first or last character of board, which are now guaranteed to be 9's. (See the function `clamp@'.)
The result: x,y coordinates are now largely irrelevant and we can just traverse every square without worrying about boundary conditions.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment