Failed job application test: program which alters 2d list based on commands

2018-02-02 21:29:24

I recently was given this question for an interview application and am wondering where I went wrong. (The whole answer is contained in a skeleton which they gave me and includes unit tests which I haven't included here so it's possible I failed due to a mistake outside the file posted here.)

The program is run by:

bitmap_reader = BitmapEditorFileReader()

The program should read a file containing string commands, and edit a 2D list based on these commands. The question is framed as a bitmap editor, i.e. the 2D list represents a bitmap image, with each element being a letter which represents a colour. The commands are as follows:

I N M - Create a new M x N image with all pixels coloured white (O).

C - Clears the table, setting all pixels to white (O).

L X Y C - Colours the pixel (X,Y) with colour C.

V X Y1 Y2 C - Draw a vertical segment of colour C in column X between

rows Y1 and Y2 (inclusive).

H X1 X2 Y C - Draw a horizont