Skip to content

Commit 8062b7b

Browse files
committed
README.md for B1
1 parent bd87353 commit 8062b7b

File tree

3 files changed

+39
-118
lines changed

3 files changed

+39
-118
lines changed

ImageDecode/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
## Group B - Exercise 1
2+
3+
### Task
4+
A **2-dimensional, black and white image**, has been scanned horizontally, vertically and diagonally (both ascending & descending).\
5+
It has been **encoded** based on the **number of black pixels** in **each row**, **each column** and **each ascending & desceding diagonal**.
6+
7+
Implement a `decode/4` predicate:
8+
- The first argument is a list with the number of black pixels in each row.
9+
- The second argument is a list with the number of black pixels in each column.
10+
- The third argument is a list with the number of black pixels in each ascending diagonal.
11+
- The fourth argument is a list with the number of black pixels in each desceding diagonal.
12+
13+
The predicate should decode the image and print it.\
14+
You may use the `diags/3` predicate implemented in [Exercise 1 of Group A](../MatrixDiagonals).
15+
16+
17+
### Execution Example
18+
Input:
19+
20+
?- decode(
21+
[4,4,3,3,4,4],
22+
[2,2,2,4,2,4,2,2,2],
23+
[0,2,1,0,2,1,5,5,1,2,0,1,2,0],
24+
[0,2,1,0,2,1,5,5,1,2,0,1,2,0]
25+
).
26+
27+
Output:
28+
29+
. * * . . . * * .
30+
* . . * . * . . *
31+
. . . * * * . . .
32+
. . . * * * . . .
33+
* . . * . * . . *
34+
. * * . . . * * .
35+
36+
### Implementation
37+
The `decode` predicate is implemented in `decode.pl`, along with several helper predicates.\
38+
The `diags\3` predicate, implemented [here](../MatrixDiagonals/diags.pl) is also used.

ImageDecode/decode.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
:- lib(ic).
55

66
% diags.pl file (ex1) is required
7-
:- [diags].
7+
:- ['../MatrixDiagonals/diags.pl'].
88

99
% Lecture code --------------------------
1010
make_matrix(M, N, Matrix) :-

ImageDecode/diags.pl

Lines changed: 0 additions & 117 deletions
This file was deleted.

0 commit comments

Comments
 (0)