Saturday, July 5, 2014
Forth on the Fifth
I was shooting for a forth on the fourth --- but, no way. I guess I might have to wait
for another " Fourth/fourth " ??????
Anyway, futzing quite along, I create this new object - which I need to futz with yet more
but just so I'm close to the fourth --- this is it:
\ sq-obj
object class pre-sq
method set-sq
method print-sq
method load-sq
class;
pre-sq class sq-obj
cell var offset
cell var index1-1
cell var index1-2
cell var index2-1
cell var index2-2
cell var square-no
how:
: set-sq ( n -- )
dup square-no ! 1 = if 0 offset ! 3 index1-1 ! 0 index1-2 ! 3 index2-1 ! 0 index2-2 ! else
square-no @ 2 = if 3 offset ! 3 index1-1 ! 0 index1-2 ! 3 index2-1 ! 0 index2-2 ! else
square-no @ 3 = if 6 offset ! 3 index1-1 ! 0 index1-2 ! 3 index2-1 ! 0 index2-2 ! else
square-no @ 4 = if 0 offset ! 6 index1-1 ! 3 index1-2 ! 3 index2-1 ! 0 index2-2 ! else
square-no @ 5 = if 3 offset ! 3 index1-1 ! 0 index1-2 ! 3 index2-1 ! 0 index2-2 ! else
\ bologna, ketchup, and lettuce
square-no @ 6 if 6 offset ! 3 index1-1 ! 0 index1-2 ! 3 index2-1 ! 0 index2-2 ! else
square-no @ 7 = if 0 offset ! 9 index1-1 ! 6 index1-2 ! 3 index2-1 ! 0 index2-2 ! else
square-no @ 8 = if 3 offset ! 9 index1-1 ! 6 index1-2 ! 3 index2-1 ! 0 index2-2 ! else
square-no @ 9 = if 6 offset ! 9 index1-1 ! 6 index1-2 ! 3 index2-1 ! 0 index2-2 ! then
then then then then then then then ;
: print-sq ( n -- ) set-sq
index1-1 @ index1-2 @ ?do i line-no-here !
index1-1 @ index1-2 @ ?do i column-calc2 + offset-here @ + c@ emit
loop loop ;
class;
\ end class
And it's also interesting to note that index2-1 is alway 3 and index2-2 is always 0 ???
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment