# What are coordinates and why should I care?

Coordinates is a way of giving names to positions in a grid.

For example the position of a chess-piece can be named by giving a letter and a digit. For example: The top left cell would be designated A1 and the top right cell H1.

In the same way can the position of a flat in a building be references by the combination of the staircase and floor numbering. The same basic principle can be used designate cells in grids in more broad situations.

There are some conventions regarding coordinates:

• The horizontal direction (left-right) is often called the x-axis and the vertical direction (up-down) is often called the y-axis.

• When the coordinates of a position is given as a sequence of numbers, to put the x-coordinate before the y-coordinate. Like this: (x, y).

# Let's try it out

1

Type the following into the the box where it says Enter source code here:

 fillSquare(7, 2);
2

Click Check source code.

3

Click Run!.

So, what is happening here?

The function fillSquare() is taking two arguments, an x-coordinate and a y-coordinate, and will fill the square at those coordinates with dark grey when called.

Note that in programming, one almost allways start counting on zero, not one.

Now, for fun, try this:

 12345678 fillSquare(3, 3); fillSquare(6, 3); fillSquare(2, 6); fillSquare(7, 6); fillSquare(3, 7); fillSquare(6, 7); fillSquare(4, 7); fillSquare(5, 7);

As an exercise: Write a program that draws the first letter of your name.

When you feel that you understand the content of this lesson. You are perhaps ready for the following lessons:
The 3d monochrome arcade foundation
How to make a 3d monochrome arcade game
The Grid foundation
How to make a Grid game
The Manhattan maze puzzle foundation
How to make a Manhattan maze puzzle game
The Tokyo maze puzzle foundation
How to make a Tokyo maze puzzle game