Move pattern on basis of the change of x coordinates and y coordinates respectively
public static final int cx [ ] = { 1 , 1 , 2 , 2 , - 1 , - 1 , - 2 , - 2 } ; public static final int cy [ ] = { 2 , - 2 , 1 , - 1 , 2 , - 2 , 1 , - 1 } ;