scrom / Experiments

a NodeJS text adventure - deliberately coded badly to re-experience the pain of legacy code
http://mvta.herokuapp.com/
2 stars 0 forks source link

If a creature can't reach its destination after n attempts, give up and move on #396

Closed scrom closed 8 years ago

scrom commented 8 years ago

if a creature cannot see a path to their destination they'll randomly wander for 1 move and then try again. I'd like it to determine after say 15 moves that their desired destination isn't accessible and clear it (shift to cleared list) and move onto their next destination.

After they've wandered home a couple of times, the destination will come up again.

If at any time during the waiting n moves the destination is available (even briefly), the counter should reset and only restart when the destination is not accessible again. (this allows creatures to potentially tailgate others.

The most common scenario for this need is where a creature needs a key to reach a destination and they've either given it away or lost it at some point.

scrom commented 8 years ago

sorted and mocha tests written/passing to test both giving up and counter resetting if briefly accessible