You could always use some
You could always use some bit trickery to condense your 16 bits down to 8, that way you can control the compression method, rather than just hoping that the lack of resolution doesn’t cause you any trouble =)
If we take the 16 original bits coming from the sensors:
Left Map [l7, l6, l5, l4, l3, l2, l1, l0] where bit l7 is on the far left
Right Map [r7, r6, r5, r4, r3, r2, r1, r0] where bit r0 is on the far right
We can condense them into a new byte, using a couple of different methods:
• Cautious Map [l7&l6, l5&l4, l3&l2, l1&l0, r7&r6, r5&r4, r3&r2, r1&r0]
Using the AND/& operator means that both adjacent bits have to be safe/‘1’ for the corresponding new bit to also be 1. In other words, Walter will flag that area as unsafe if he detects anything in that 8th of his view.
• Reckless Map [l7|l6, l5|l4, l3|l2, l1|l0, r7|r6, r5|r4, r3|r2, r1|r0]
This time the OR/| operator is used, so if at least one bit in that area of Walter’s view is safe, then Walter will determine that the entire 8th of the view is safe.
Now, you might think that there would only ever be reason to use the Cautious Map, but the Reckless Map may be useful for determining possible paths from further away. Or maybe if Walter can’t find any paths using the Cautious Map he’ll get impatient and move towards potential paths as dictated by the Reckless Map for a closer look, just in case they turn out to be wider than they seemed from a distance.