view src/lifter.tp @ 36:814e3d482ad3

Make navigable a property of the cell type so I can use it in lifter
author Mike Pavone <pavone@retrodev.com>
date Sun, 15 Jul 2012 11:07:11 -0700
parents f7a1daaec925
children 9bccdb3ac979
line wrap: on
line source

#{
	abs <- :val {
		if: val < 0 { 0 - val } else: { val }
	}
	
	distanceFrom:to <- :sx sy :dx dy {
		(abs: sx - dx) + (abs: sy - dy)
	}
	
	main <- {
		text <- sim readFd: 0
		playfield <- (sim state) fromStr: text
		os write: 2 text
		os write: 2 "width: " . (string: (playfield width)) . "\n"
		os write: 2 "height: " . (string: (playfield height)) . "\n"
	}
}