Highlights
Your script should gracefully handle the following exceptions:
1. No argument provided
2. Input provided is not binary
3. Input rows are not all the same size
Task 2: 2D Edge Detector
Create a script which will detect edges in a 2D set of binary values. You should compare each value to the ABOVE and the LEFT. So if a 1 has a 0 in the position ABOVE or LEFT of itself, then you would output a 1 in that position, indicating an edge (or vice versa). In the instance that there is nothing to the left or above the character being examined, then you should assume that an identical character is in the empty position.
To illustrate this please look at the below example:
*Note: the above example assumes you were coding your script in RUBY, you should use an extension appropriate to the scripting language you select.
Exceptions will be tested, you should handle the following:
1. Non-binary input
2. Irregular input, eg:
A. 00000000
B. 0001
C. 000000
Note:
1. Efficiency will be graded, primarily – if the PREVIOUS character on the same line does not match, don’t test the one above (or vice versa, depending on your order of comparisons)© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.