You will write three small functions for the corner point method. The checker tests them on regions with ties and with negative numbers.
The idea. For , work out at each corner. The best value is the largest for a maximum and the smallest for a minimum. Several corners may share the best value.
Your tasks.
z_value(a, b, point). Return at the point (x, y).corner_values(a, b, corners). Return the list of values, one for each corner, in the same order.best(a, b, corners, sense). Return the best value and the list of corners that reach it. The text sense is "max" or "min".Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…