# HG changeset patch # User Mike Pavone # Date 1342398443 25200 # Node ID 5d2e59cbbc7c35549e75e8199a62f9c6eaedc2d7 # Parent 9f1ca5ba26848091a7e92fc76ec660826f8a4dd9# Parent 1f583d85c8ed4f6f067d52485305f3d3c8f5a782 Merge diff -r 9f1ca5ba2684 -r 5d2e59cbbc7c src/sim.tp --- a/src/sim.tp Sun Jul 15 17:26:25 2012 -0700 +++ b/src/sim.tp Sun Jul 15 17:27:23 2012 -0700 @@ -211,10 +211,25 @@ x <- calcX: index y <- calcY: index below <- getCell: x (y - 1) + fallToSide <- :delta { + side <- getCell: (x + delta) y + belowSide <- getCell: (x + delta) (y - 1) + if: (side eq: (cellTypes empty)) { + if: (belowSide eq: (cellTypes empty)) { + setCell: (x + delta) (y - 1) value + setCell: x y (cellTypes empty) + true + } else: { false } + } else: { false } + } if: (below eq: (cellTypes empty)) { setCell: x y (cellTypes empty) setCell: x (y - 1) value - } + } else: { if: (below eq: (cellTypes rock)) { + if: (not: (fallToSide: 1)) {fallToSide: -1} + } else: { if: (below eq: (cellTypes lambda)) { + fallToSide: 1 + }}} // end if } else: { if: (value eq: (cellTypes closedLift)) { if: (_robot collected) = lambdaCount { @@ -294,22 +309,6 @@ ret lambdaCount!: (ret lambdaCount) + 1 } } - - -// adding a 'new' method to robot and doing this instead -// wolud allow me to treat robots and other cellTypes equaly -// particularly for adding methods or state to other cellTypess. -// -// if: (el = (cellTypes robot)) { -// robot <- el new: -// (ret grid) set: index robot -// robot mine!: ret -// ret updatePos: robot index -// nextGrid append: el -// } else: { -// nextGrid append: el -// } - } ret }