if you are at (0, 0) you can move to (0, 1) and (1, 0), but your code tells me that you will move nowhere.