Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CMT304

Programming Paradigms

2022

Submission Instructions

This is assignment is a portfolio that consists of three tasks. You are required to solve all tasks.  Each of the three tasks below is worth 1/3 of the marks, summing up to 100 of the total marks available for this module.

All submissions must be via Learning Central.Submit the following les in a single zip le, [student  number] .zip:

Description

Type

Name

Cover Sheet

Compulsory

One PDF (.pdf) le

[STUDENT-NUMBER] .pdf

Task 1.1

Compulsory

One source le

task1-1 .lp

Task 1.2

Compulsory

One PDF (.pdf) le

task1-2 .pdf

Task 2.1

Compulsory

One source le

task2-1 .hs

Task 2.2

Compulsory

One PDF (.pdf) le

task2-2 .pdf

Task 3

Compulsory

One PDF (.pdf) le

task3 .pdf

Any deviation from the submission instructions above (including the number and types of files submitted) may result in a mark of zero for the task affected.

Staff reserve the right to invite students to a meeting to discuss coursework submissions.

Your submissions will be checked for plagiarism. Your work must be your own and you must independently solve the problem and submit your own solution. Any other material or sources of information you use must be referenced. Code and text you submit will be compared with other submissions and various other sources on and off the Internet. Any substantial similarities of your submission to unreferenced work or material not created by yourself will be subject to academic misconduct proce- dures. Marks will only be assigned for work you have done yourself (incl. nding and discussing material from references, but not the referenced work; there are no marks for code copied from elsewhere, but for either writing your own code or integrating and adapting code that you have not written).

Task 1.1

Consider the problem of solving Hitori puzzles.  Hitori is played in an n x n grid of cells, where each cell contains a number j e {1, . . . , n}. The objective is to remove cells (marked as black), so that the three following rules are satisfied.

1.  No number appears more than once in a row or column.

2. The eliminated black cells cannot be horizontally or vertically adjacent.

3. The remaining numbered (white) cells must be connected to each other, i.e., any white cell is reachable from another white cell by vertical or horizontal movements through white cells.

You can nd an example of a  Hitori puzzle and a solution  in Wikipedia: https://en. wikipedia.org/wiki/Hitori

Write an ASP program (hitori .lp) that solves the puzzle for any instance. Your program will receive as input a set cell/3 of triples r, c, n such that the grid has number n in row r , column c. The output of your program is a set cellblack/2 of pairs r, c such that the cell at row r, column c is eliminated.

Document your code so the following is clear.

1. What the approach to solving the problem is.  In particular, you need to explain what

each rule achieves and how the rule achieves it.

Include your name and student id in the comments.

Task 1.2:

Write a short report on answer set programming related to the problem:

1.  Provide, in up to 300 words, two arguments for and two arguments against using answer set programming to solve this problem.

2.  Discuss, in up to 300 words, whether the logic programming paradigm is suitable for this problem or whether another paradigm of your choice is more appropriate, based on your previous arguments.

The word limits are an upper limit, not a target length.  Text longer than the word limit for each point may be ignored. Clearly mark each argument in your answer of the rst point and

indicate whether it is for or against. Only provide two arguments for and against; additional arguments will be ignored.

Criteria for assessment of Task 1

Task 1.1: maximum 50 marks, assessed according to the following scale:

Fail

0

No code has been submitted.

1 - 14

Code does not run or does not produce valid output for any valid input; little to no relevant documentation.

15 - 24

Code is valid without syntax errors and creates a valid output for every valid input (or produces a suitable error message for valid cases it cannot process). The output is not a solution, but a suitable attempt to solve the problem is visible. An attempt to document the code has been made.


Task 1.2: maximum 50 marks, assessed according to the following scale:

Fail

0

No document has been submitted.

1 - 14

An insufcient number of arguments has been submitted and/or they hardly apply to the logic programming paradigm. At most an incomplete attempt to discuss the suitability of the logic paradigm has been made.

15 - 24

An insufcient number of arguments has been submitted, but they show some understanding of the logic programming paradigm. An attempt has been made to discuss the suitability of the logic paradigm, but it hardly relates to the paradigm.

Pass

25 - 29

The required number of valid arguments has been submitted. They are generally valid for the logic programming paradigm, but they repeat simi- lar issues, do not consider the specic problem or contain mistakes in the details. A attempt has been made to discuss the suitability of the logic paradigm and some understanding of this paradigm is present.

Merit

30 - 34

The required number of valid arguments has been submitted. They show a clear understanding of the logic programming paradigm and it relates to the problem. The discussion of the suitability of the logic paradigm is well-developed, showing a clear understanding of the issues involved, and indicates the differences to the other chosen paradigm.