Submissions by Harley tagged starting-forth

The exercise 8-7 was Tic-Tac-Toe, so I decided to give that one a shot. It ended up being pretty easy based on the requirements they gave in the example. I didn't really like the the 1-9 placement, so I decided to do x, y top left as 0, 0 and bottom right as 2, 2 instead. It was pretty nice to see that the code I came up with wasn't vastly different than the answer they provided.


I also completed exercise 7-9 which was to display numbers 0-16 in bases 2, 10, & 16. This one was pretty trivial.

7-9.fth158 bytes
6 downloads
8-7.fth490 bytes
4 downloads

I ran a bit short on time for today. I ended up revisiting d* from yesterday. d* is a forth word to multiply a double length number by a single length number leaving a double length number on the stack ( d n -- d )

I had a fair amount of trouble with it, but coming back to the problem after sleeping on it helped. Using d* from my submission yesterday simplifies it quite a bit.

-- Edit after deadline --

After a bit more looking, it would seem I missed the m*/ word. d* becomes an alias for:

: d* 1 m*/ ;

Not only that, but mine runs at half the speed as that one on gforth. Oh well.

dstar.fth332 bytes
quad.fth154 bytes

Did some more of the exercises from chapter 7 of Starting Forth. This time was 7.3 & 7.7.

7.3 I found to be nearly trivial. The biggest annoyance there was doing a busy wait sleep function. After looking at their answer, it was somewhat nice to find out 500 MS could be used.

I thought 7.7 was going to be nearly trivial. I got a single cell version working very quickly. However, upon rereading the excercise, I realized they were specifically asking for a double cell variant (which makes sense in retrospect since I think they did a similar quadratic function in an earlier chapter.) It ended up taking me a fair amount of time to really work that out, but at least I had a working single cell variant to double check my work with.

I ended the night with playing around with defining a word: d* ( d n -- d ) However, I didn't really get it working.

quad.fth247 bytes
2 downloads
rings.fth141 bytes