This activity uses just one type of barcode, known as EAN-13. Most products sold in Australian shops have EAN-13 barcodes, but other types of barcodes are used for things like letters and library books.
Barcodes are designed to be very easy for computers to read the sequence of numbers beneath them. If the scanner doesn’t work, a shop assistant can type in the number instead of scanning the barcode.
The widths of the stripes are all based on the widths of the starting stripes, so it doesn’t matter what size the whole barcode is. This also means they can read barcodes from different distances, and at different angles.
Barcodes have a lot of ways of checking whether they’ve read properly. Each digit is as wide as seven thin stripes; if the reader reads the wrong number of stripes, or the distances don’t add up, the computer knows something is wrong and it can scan again.
You might also have noticed some patterns in the codes. Each stripe in an R-code digit is the same width as each stripe in the same L-code digit. Only the colours are reversed. G-code is exactly the same widths as L-code, except back to front with the colours reversed.