Added calculate_delta, used in prepare_move
Added square helper function