CSG6206 – Advanced Scripting
Portfolio 3
IMPORTANT
When completing portfolio 2 you may select any ONE of the TWO tasks included in this document. Each task has its own set of requirements which you should make sure that you understand.
Marking Ru
ic
Criteria (Marks Possible)
Excellent XXXXXXXXXX%)
Good (60-79%)
Fair (50-59%)
Poor (0-49%)
Execution (4)
Program executes co
ectly with no e
ors
Program executes with one easily fixed e
o
Program executes with a few minor, easily fixed e
ors
Program does not execute
Output (4)
Program displays all required output in a well-designed manner, meeting all specifications
Program displays all required output in a well-designed manne
Program displays all required information
Program does not display all required information
Logic (4)
Program logic is efficient and well designed
Program logic is well designed
Program logic meets requirements
Program logic does not meet requirements
Standards (4)
Program style is neat and readable
Program style contains a few inappropriate choices (variable names, indentation, etc)
Program style contains several inappropriate choices (variable names, indentation, etc)
Program style is poo
Documentation (4)
Program is well documented, with usage information and adequate comments throughout
Program contains usage information but is missing a few comments
Program does not contain usage information and is missing a few comments
Inadequate usage information and comments are present
Task 1: Image Creation
Write a script that will convert an a
ay of 1’s and 0’s to a black and white (monochrome) PNG image. Where 1 represents a black pixel and 0 represents a white pixel. The image will be saved to the filename indicated in the first argument.
The text file will contain the a
ay of 1s and 0s
10101
01010
10101
01010
10100
An example command line is provided below:
printf a
ay.txt | php binary_to_image.php out.png
*Note: the above example assumes you were coding your script in PHP, you should use an extension appropriate to the scripting language you select.
In this instance your script would create a new image from the standard input provided and draw each pixel one at a time and then write the image as out.png.
out.png
Your script should gracefully handle the following exceptions:
· No argument provided
· Input provided is not binary
· Input rows are not all the same size
Submission Requirements
Submit your assignment under the Portfolio 3 section on blackboard
Notes
Your work must comply with ECU referencing guidelines and plagiarism policy
Task 2: 2D Edge Detecto
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:
cat input.txt
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
cat input.txt | ruby workshop5.
Input:
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
Output:
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
XXXXXXXXXX
*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:
· Non-binary input
· I
egular input, eg:
· XXXXXXXXXX
· 0001
· 000000
Note:
· 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)
Submission Requirements
Submit your assignment under the Portfolio 3 section on blackboard
Notes
Your work must comply with ECU referencing guidelines and plagiarism policy