If the ant is on a black square, it turns right. and moves forward one unit. If the ant is on a white square, it turns left. and moves forward one unit. When the ant leaves a square, it inverts the color.