robot f x y = n + e + s + w
            where n | y > 0 && not (testBit f (x+4*(y-1))) = robot (setBit f (x+4*(y-1))) x (y-1)
                    | otherwise                            = 0
                  e | x < 3 && not (testBit f (x+1+4*y))   = robot (setBit f (x+1+4*y)) (x+1) y
                    | otherwise                            = 0
                  s | y < 3 && not (testBit f (x+4*(y+1))) = robot (setBit f (x+4*(y+1))) x (y+1)
                    | otherwise                            = 0
                  w | x > 0 && not (testBit f (x-1+4*y))   = robot (setBit f (x-1+4*y)) (x-1) y
                    | otherwise                            = 0
robot f x y = n + e + s + w
            where n | y > 0 && not (testBit f (x+4*(y-1))) = robot (setBit f (x+4*(y-1))) x (y-1)
                    | otherwise                            = 0
                  e | x < 3 && not (testBit f (x+1+4*y))   = robot (setBit f (x+1+4*y)) (x+1) y
                    | otherwise                            = 0
                  s | y < 3 && not (testBit f (x+4*(y+1))) = robot (setBit f (x+4*(y+1))) x (y+1)
                    | otherwise                            = 0
                  w | x > 0 && not (testBit f (x-1+4*y))   = robot (setBit f (x-1+4*y)) (x-1) y
                    | otherwise                            = 0
robot f x y = n + e + s + w
            where n | y > 0 && not (testBit f (x+4*(y-1))) = robot (setBit f (x+4*(y-1))) x (y-1)
                    | otherwise                            = 0
                  e | x < 3 && not (testBit f (x+1+4*y))   = robot (setBit f (x+1+4*y)) (x+1) y
                    | otherwise                            = 0
                  s | y < 3 && not (testBit f (x+4*(y+1))) = robot (setBit f (x+4*(y+1))) x (y+1)
                    | otherwise                            = 0
                  w | x > 0 && not (testBit f (x-1+4*y))   = robot (setBit f (x-1+4*y)) (x-1) y
                    | otherwise                            = 0