### patch

#### patch xcor ycor

Given the x and y coordinates of a point, reports the patch containing that point. (The coordinates are absolute coordinates; they are not computed relative to this agent, as with patch-at.)

If x and y are integers, the point is the center of a patch. If x or y is not an integer, rounding to the nearest integer is used to determine which patch contains the point.

If wrapping is allowed by the topology, the given coordinates will be wrapped to be within the world. If wrapping is not allowed and the given coordinates are outside the world, reports nobody.

    ask patch 3 -4 [ set pcolor green ]
    ;; patch with pxcor of 3 and pycor of -4 turns green
    show patch 1.2 3.7
    ;; prints (patch 1 4); note rounding
    show patch 18 19
    ;; supposing min-pxcor and min-pycor are -17
    ;; and max-pxcor and max-pycor are 17,
    ;; in a wrapping topology, prints (patch -17 -16);
    ;; in a non-wrapping topology, prints nobody

See also patch-at.

Take me to the full NetLogo Dictionary