implemented moves and neighbors.