MyLeoNes™

Coordinates and grids — Computing, 7–10 years

A grid gives every place a position. Programs use positions to put characters, draw shapes and move objects without guessing.

Giving every place an address

A coordinate is an address for a place on a grid. Usually, the first number tells how far across to go and the second tells how far up or down. The pair (3, 2) means one exact square, not a general area.

Why use coordinates?

A computer cannot place a character by saying “somewhere near the corner”. It needs numbers that describe an exact position, so pictures and games can be built consistently. The grid idea came from maps and geometry, where people needed to describe places accurately.

Moving on a grid

A robot starts at (2, 1). The instruction “move 3 squares right” changes the first number: 2 + 3 = 5, so it reaches (5, 1). Then “move 2 squares up” changes the second number: 1 + 2 = 3. Its new position is (5, 3).

The trap: swapping the numbers

A common mistake is reading (3, 5) as five across and three up. That feels reasonable because the two numbers look equally important, but the program has assigned them different jobs. Reading the sideways position first, then the up-and-down position, keeps every address unambiguous.

Where it helps

Games use coordinates to place a player, treasure or obstacle on the screen. Drawing programs use them for the corners of shapes, and maps use a related idea to locate places. A coordinate is useful when an exact position matters.

Keep exploring

Other languages

Loading MyLeoNes™…