Use gr_set_function; Declare headers; init functions gr_get_neighbors and gr_set_cell