playgrid_legal move_player(playgrid_direction direction, int x_new, int y_new, PlayGrid* grid, Square_list* updated){
	playgrid_object new_object;	//object at new square
	
	new_object = get_Playgrid_object(x_new,y_new,grid);
	
	//is the new square legal to move to	
	switch(new_object){
		case ROCK://try to move the rock
			if(ILLEGAL == move_object(x_new, y_new, direction, grid, updated) ){
				return ILLEGAL;			
			}
		break;

		case EMPTY://EMPTY is fine
		break;		
			
		default:
			return ILLEGAL;
		break;
	}
	//everything seems fine, move player

	update_square( grid, EMPTY,grid->player_x, grid->player_y, updated);
	update_square( grid, PLAYER,x_new, y_new, updated);
	return LEGAL;
}
playgrid_legal move_rock(int x,int y, int x_new, int y_new, PlayGrid* grid, Square_list* updated){
	playgrid_object new_object;	//object at new square
	
	//is there already a rock at the new square?
	new_object = get_Playgrid_object(x_new,y_new,grid);
	switch(new_object){
		case ROCK:
			return ILLEGAL;
		break;
		case EMPTY:
			//move object:
		break;		
		default:
			return ILLEGAL;
		break;
	}
	
	//everything seems fine, move rock
	update_square( grid, EMPTY,x, y, updated);
	update_square( grid, ROCK,x_new, y_new, updated);


	return LEGAL;
}
//  Attempts to update the owners of all squares that a new line
//  might affect.  Returns true if one or more squares receives a
//  new owner.
static bool update_squares()
{
	bool lt = update_square(LeftTop), rt = update_square(RightTop),
		lb = update_square(LeftBottom), rb = update_square(RightBottom);
	return lt || rt || lb || rb;
}