forked from afl-eafit/2019-2-lab1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab1.html
190 lines (152 loc) · 6.44 KB
/
lab1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Programming Lab 1</title>
</head>
<body>
<h1 style="text-align:center;">Programming Lab 1:
Representing Images with Deterministic Finite Automata</h1>
<h3>TA: Alejandro Murillo G.</h3>
<h3>Introduction</h3>
<p>Deterministic Finite Automata (DFA) enable the representation of
multiple structures. One of those are images, as described
by Culik and Valenta (1996). The goal of this programming
lab is to represent images, given its pixels, using DFAs.</p>
<h3>Assignment (80%)</h3>
<ul>
<li>
<p>Download the <a href="https://github.com/">GitHub</a>
repository <a
href="https://github.com/afl-eafit/2019-2-lab1">2019-2-lab1</a>.</p>
</li>
<li>
<p>(70%) Using the data types in the above repository define the
functions:</p>
<pre> img2dfa :: ImagePixels -> FiniteAutomata state symbol</pre>
<p>that takes an image's pixels and returns a DFA that describes
the image;</p>
<pre> createImage :: Int -> FiniteAutomata state symbol -> DynamicImage</pre>
<p>that takes the image's size scale factor n and the
DFA that describes the image, and returns an image created using
the DFA.</p>
<p></p>
<p>You will need the library <a href="https://bit.ly/2Kf7Gwz">
JuicyPixels</a> to generate and save the images.</p>
</li>
<li>
(10%)
<ul>
<li>Your lab will be tested using the <code>-Wall</code>,
<code>-Wmissing-local-signatures</code> and
<code>-Wmissing-signatures</code> options.</li>
<li>Annotate (in English) your source code using <a
href="https://bit.ly/2LYUQ82">Haddock</a>. Documentation
should explain your solution for the assignment.</li>
<li>Improve your implementation with <a
href="https://github.com/ndmitchell/hlint">HLint</a>.</li>
</ul>
</li>
<li>
<p>The programming lab may either be solved on your own, or
jointly with one other student taking the course.</p>
</li>
<li>
<p>You are to use GHC[i] ≥ 8.6.5.</p>
</li>
</ul>
<h3>Examples</h3>
<p>Using the <code>FiniteAutomata.hs</code> module in the above
GitHub repository, this is what a sample input-output looks
like:</p>
<pre>
GHCi> cb = img2dfa chessBoard
GHCi> cb_img = createImage 7 cb
GHCi> savePngImage "chessBoard.png" cb_img
</pre>
<p>Once the automaton is generated, and its image created, you could
use the <code>savePngImage</code> function to save the PNG image named
"chessBoard" (a 128 x 128 white and black image) to the current
working directory.</p>
<p> In the case of the chess board, given the parameters in the example,
you should obtain the following image:</p>
<center><img src="https://bit.ly/33lOjti"
alt="8x8 Chess Board of size 128x128"
title="8x8 Chess Board of size 128x128"
align="bottom"></img></center>
<p> For the Sierpiński Triangle, the DFA should generate:</p>
<center><img src="https://bit.ly/2KoQoxm"
alt="Sierpiński Triangle of size 128x128"
title="Sierpiński Triangle of size 128x128"
align="bottom"></img></center>
<h3>Clean code (10%)</h3>
<p>Before submitting your code, which includes your
<tt>README</tt> file (see below), clean it up:</p>
<ul>
<li>Does not have long lines (at most 80 columns).</li>
<li>Has an uniformly indentation (we recommended two
characters).</li>
<li>Has a consistent layout.</li>
<li>Has type signatures for everything (included
<code>where</code>-clauses and
<code>let</code>-definitions).</li>
<li>Has no junk (unused code, commented code, unnecessary
code).</li>
<li>Has no overly complicated function definitions.</li>
<li>Does not contain any repetitive code.</li>
<li>Has no tabs.</li>
<li>Has no unnecessary spaces at the end of a line, or empty
lines at the end of a file. (See: <a
href="http://www1.eafit.edu.co/asr/tips-and-tricks.html#
fixing-trailing-whitespace-issues"> Fixing trailing whitespace
issues with Emacs</a>).</li>
<li>Has spell-checked comments.</li>
</ul>
<h3>Submission (10%)</h3>
<p>Submission is electronic. Send an email to
<tt>asr(at)eafit(dot)edu(dot)co</tt> and
<tt>amurillog(at)eafit(dot)edu(dot)co</tt> and attach a compressed
file (<tt>.zip</tt> or <tt>.tar.gz</tt>) with your solution.</p>
<p>Your submission has to include the following:</p>
<ul>
<li><tt>ConstructAutomaton.hs</tt>, a Haskell module file with your
solution for the assignment.</li>
<li>
A plain text file <tt>README.txt</tt> (or a Markdown file
<tt>README.md</tt>), a file (in English) containing at least
the following information:
<ul>
<li>The name of your program.</li>
<li>Your name(s).</li>
<li>A general description of your program.</li>
<li>Information on how to use your program.</li>
<li>GHC and/or Haskell platform versions used.</li>
</ul>
</li>
<li>Do not include any other files.</li>
</ul>
<h3>Bibliography</h3>
<ul>
<li>K. Culik and V. Valenta (1996). Finite Automata Based
Compression of Bi-level Images, in Data Compression Conference,
IEEE Computer Society, pp. 280-289. <a
href="https://doi.org/10.1109/DCC.1996.488333">DOI</a>. <a
href="https://bit.ly/2LYVLW1">Available via SINBAD at EAFIT</a>.
</li>
</ul>
<hr />
<table style="width:100%">
<tr>
<td><a href=
"http://www1.eafit.edu.co/asr/courses/automata-cm0081/">
Automata and formal languages - CM0081</a></td> <td
style="text-align:right;"><a
href="http://validator.w3.org/check?uri=referer"><img
src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML
1.1" height="31" width="88" /></a></td>
</tr>
</table>
</body>
</html>