Here are quite a few bugs in the swimmer behavior. Because they are all caused by different lines in the code, I will only explain the unexpected behavior, but not its cause in detail. The small pillars in the test maps give the height of the trigger area of the water. Apart from the obvious exceptions, they do not interact with the swimmer.
SwimmerTest.lvl
1) Top right: Lem should fall into the gap, but does not. If one side would be solid, the swimmer would safely reach it and transition to walker.
2) Top left: When reaching the top water, there is one frame where the lemming jumps out of the water and is a faller! Lemmings are dolphins
!
3) Bottom left: When reaching the terrain, there is one frame where the lemming is a faller!
4) Middle left: Here the miracle occurs: If one mixes the previous two setups, the bugs cancel and the swimmer correctly transitions directly to a walker
.
SwimmerClimberTest.lvl (all lemmings are here swimmers and climbers!)
1) Top: Swimmer correctly transitions to faller.
2) Upper middle: Swimmer transitions to faller. Expected would be to climb the pillar. This is due to the tendency to dive down rather than climb, even if there is no more water down there. --> Rule should be: Only dive if there is still water!
3) Lower middle: Swimmer climbs now correctly at the pillar.
4) Bottom: There is actually one pixel (exactly at lemming height), which is not checked at all for terrain! This lemming should transition to walker, instead of climbing.