walkInside m old d = if inside then new else old
  where 
    new = walk old d
    inside = Map.member new m

square = Map.fromList [((x, y), toNum x y) | x <- [0..2], y <- [0..2]]
  where
    toNum x y = x + y * 3 + 1

diamond = Map.fromList $ row0 ++ row1 ++ row2 ++ row3 ++ row4
  where
    row0 = [((2, 0), 1)]
    row1 = [((i, 1), i + 1) | i <- [1..3]]
    row2 = [((i, 2), i + 5) | i <- [0..4]]
    row3 = [((i, 3), i + 9) | i <- [1..3]]