6
$\begingroup$

I'm trying to unravel the algorithm for an old 1980s game called Wanderer. The game is a simple grid: 16 cells high (all visible in the image) and 40 cells wide (though not all are depicted). In the game lots of things happen, but I'm only concerned with an sequence of falling boulders. They fall in a sequence governed by specific rules as to how they can be triggered and how triggers are priorised. The full sequence is triggered by a single move by the player, and there are definitely no other influences at work - it's a self contained system. Here is the before and after layout of the player's one move (to the left):

enter image description here

The boulders tumble in the following sequence:

enter image description here

I am trying to understand the logic of this sequence.

Some notes:

  1. Boulders only move when one of the following rules are satisfied:
    1. the cell below them is unoccupied,
    2. the cell below is a slide (shown white in the screenshots), the next cell on the opposite side from the slide 'wall' is unoccupied, as well as the cell below that - they essentially just slide down the wall,
    3. they can also role off boulders if a way to slide off them to one side, but in this scenario it only happens at the bottom of the screen so we can ignore this rule.
  2. When any boulder starts falling nothing else moves until that boulder has stopped at the bottom.
  3. In the game the player can trigger boulders 1 column sideways and 2 rows above (8 cells in total) when they move away from the boulders when underneath or alongside them. These positions are relative to the players initial position, not after they have moved. It is possible the player's move in this scanario triggered just the bouder next to it, or alternatively up to 4 boulders (numbered 1,2,3,5). It is unclear to me how many boulders were triggered by the fall of boulder #1.
  4. There may be a queue in operation, but it's unclear how boulders are prioritised to join it, or whether they can join when still unable to move at that moment, or only once they are potentially able to move.
  5. There is an interesting spatial repetition in the 2-5 and 6-9 sequences.

If anyone is able to resolve this problem by identifying rules that unambiguously explain this seqience they get 100 genius points and my deep respect. I think I've framed this question unambiguously, but if there are any clarifications please ask.


Edit: here's a gif of the scenario using an old Wandroid app (Android) now unavailable from Google Play but still available from some sites.

enter image description here

$\endgroup$
5
  • $\begingroup$ Are you certain there are "logical" rules to how triggers are prioritized? The game could simply be iterating over an array of boulders, set in a specific order which causes this chain of events to happen. Kind of a lame explanation, but it could be as simple as that :S $\endgroup$
    – Pepper
    Commented Feb 6, 2021 at 10:10
  • 1
    $\begingroup$ @Pepper This seems to include the original source code (WANDR330.zip), and the depicted boulder example behaves the same way as shown. In FALL.C there is a recursive fall and check method, which also gets called e.g. in GAME.C. It checks some neighboring cells to determine what falls next. So I'm pretty sure there is in fact an algorithm & trigger. For my part I wasn't immediately able to understand all the logic of the entire fall method and am currently too lazy to dig into it, but the answer lies in there assuming it is the actual code. $\endgroup$ Commented Feb 6, 2021 at 10:22
  • $\begingroup$ Ah, maybe the check method is all we're looking for. It says check for any falling caused by something moving out of x,y along vector dx,dy , which seems to be exactly what we need. I tried it per hand on #2 and it seems to work in the exactly correct order. Still leaves some questions open (e.g. which one to check next? can't be "conventionally recursive", otherwise #3 would instantly move #9. I also don't think continuing on the last one (#6) would work because otherwise #9 would move #15 $\endgroup$ Commented Feb 6, 2021 at 10:31
  • $\begingroup$ Thanks all. Yes Lukas is right. For each level the only input is a simple ascii text file grid with characters showing the element type in each cell - the rest is completely rules based (as creator confirms - github.com/sshipway/wanderer/issues/12#issuecomment-767888570). I might try and unpick the code, but figured that that could end up being a bigger job than unpicking the logic from deduction! Also I think the problem stands alone as a mental challenge hence posting here :) $\endgroup$
    – geotheory
    Commented Feb 6, 2021 at 13:44
  • $\begingroup$ See gif I've added to question. $\endgroup$
    – geotheory
    Commented Feb 6, 2021 at 14:10

0

Browse other questions tagged or ask your own question.