How can I solve this coding problem

Graphic coding

Considerations for the assignments

It must be determined how a black or white pixel is coded (e.g. black as 1, white as 0). It also indicates how wide and tall the picture is. You can also code these numbers in binary. In order to be able to assign the bits, it must also be determined here how many bits are intended for the width and how many for the height of the image. These binary coded numbers may have to be padded with zeros. This is followed by the coding of the pixels.

The extra information does not have to be coded as well, that would make no sense here.

Schoolchildren usually do not address the order of the pixels. We are used to going from top left to bottom right. In cultures where one reads from right to left or from top to bottom, the students might come up with other ideas or see the need to provide this as additional information.

Additional tasks

The additional tasks are not standard.

In graphic coding, for example, more bits could be used for each pixel and the information about the color could be coded there.

For the compression, you could, for example, specify that one byte always stands for black, then one for white and that the number of pixels is coded in it. If the number does not fit into a byte, the other color is simply coded as the number 0 in between.

If you combine the two questions, the color could always be coded and then the number of pixels in this color.


Directly back to the master copy


Solution to: graphic coding: Download [odt] [73 KB]

Solution to: graphic coding: Download [pdf] [107 KB]


Go to Coding Game