Mercurial > repos > icfp2012
comparison src/lifter.tp @ 31:f7a1daaec925
Use dictionary
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sat, 14 Jul 2012 21:27:36 -0700 |
parents | 7a274d6026c8 |
children | 9bccdb3ac979 |
comparison
equal
deleted
inserted
replaced
30:031d46ff76a9 | 31:f7a1daaec925 |
---|---|
1 #{ | 1 #{ |
2 abs <- :val { | |
3 if: val < 0 { 0 - val } else: { val } | |
4 } | |
5 | |
6 distanceFrom:to <- :sx sy :dx dy { | |
7 (abs: sx - dx) + (abs: sy - dy) | |
8 } | |
9 | |
2 main <- { | 10 main <- { |
3 text <- sim readFd: 0 | 11 text <- sim readFd: 0 |
4 playfield <- (sim state) fromStr: text | 12 playfield <- (sim state) fromStr: text |
5 os write: 2 text | 13 os write: 2 text |
6 os write: 2 "width: " . (string: (playfield width)) . "\n" | 14 os write: 2 "width: " . (string: (playfield width)) . "\n" |