Mercurial > repos > icfp2012
annotate src/lifter.tp @ 40:f38437d22ebd
success is possible. W implemented. Rock movement started but not finished.
author | William Morgan <bill@mrgn.org> |
---|---|
date | Sun, 15 Jul 2012 14:35:56 -0700 |
parents | f7a1daaec925 |
children | 9bccdb3ac979 |
rev | line source |
---|---|
3
bb29dcd46cbf
Put dummy code in placeholder source files. Create makefile.
Mike Pavone <pavone@retrodev.com>
parents:
0
diff
changeset
|
1 #{ |
31 | 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 | |
3
bb29dcd46cbf
Put dummy code in placeholder source files. Create makefile.
Mike Pavone <pavone@retrodev.com>
parents:
0
diff
changeset
|
10 main <- { |
20
50a456168c25
Split readFd out of readFile for use in lifter. Add code to read map from stdin to lifter using code in sim
Mike Pavone <pavone@retrodev.com>
parents:
3
diff
changeset
|
11 text <- sim readFd: 0 |
50a456168c25
Split readFd out of readFile for use in lifter. Add code to read map from stdin to lifter using code in sim
Mike Pavone <pavone@retrodev.com>
parents:
3
diff
changeset
|
12 playfield <- (sim state) fromStr: text |
50a456168c25
Split readFd out of readFile for use in lifter. Add code to read map from stdin to lifter using code in sim
Mike Pavone <pavone@retrodev.com>
parents:
3
diff
changeset
|
13 os write: 2 text |
50a456168c25
Split readFd out of readFile for use in lifter. Add code to read map from stdin to lifter using code in sim
Mike Pavone <pavone@retrodev.com>
parents:
3
diff
changeset
|
14 os write: 2 "width: " . (string: (playfield width)) . "\n" |
50a456168c25
Split readFd out of readFile for use in lifter. Add code to read map from stdin to lifter using code in sim
Mike Pavone <pavone@retrodev.com>
parents:
3
diff
changeset
|
15 os write: 2 "height: " . (string: (playfield height)) . "\n" |
3
bb29dcd46cbf
Put dummy code in placeholder source files. Create makefile.
Mike Pavone <pavone@retrodev.com>
parents:
0
diff
changeset
|
16 } |
bb29dcd46cbf
Put dummy code in placeholder source files. Create makefile.
Mike Pavone <pavone@retrodev.com>
parents:
0
diff
changeset
|
17 } |