代做CMT304 Programming Paradigms 2024–25帮做R语言

- 首页 >> Java编程

Assessment Proforma 2024–25

Key Information

Module Code

CMT304

Module Title

Programming Paradigms

Assessment Title

Functional Programming

Assessment Number

Part 2 of the 4-part portfolio coursework

Assessment Weighting

25% of the portfolio coursework

Assessment Limits

Hand-out: 22nd of November 2024

Hand-in: 10th of April 2025, 9:30am

Feedback expected by: 13th  of May 2025

Limits are per task as set in the instructions

The Assessment Calendar can be found under ‘Assessment & Feedback’ in the COMSC–ORG– SCHOOL organisation on Learning Central. This is the single point of truth for (a) the hand out date and time, (b) the hand in date and time, and (c) the feedback return date for all assessments.

1    Learning Outcomes

The learning outcomes for this assessment are

•  Explain the conceptual foundations, evaluate and apply various programming paradigms, such as logic, functional, scripting, filter-based programming, pattern matching and quantum com- puting, to solve practical problems.

•  Discuss  and contrast the issues, features, design and concepts of a range of programming paradigms and languages to be able to select a suitable programming paradigm to solve a problem.

2   Submission Instructions

The coversheet can be found under ‘Assessment & Feedback’ in the COMSC–ORG–SCHOOL or- ganisation on Learning Central.

All files should be submitted via Learning Central. The submission page can be found under ‘As- sessment & Feedback’ in the CMT304 module on Learning Central. Your submission should consist of these files:

Description

Type

Name

Coversheet

Compulsory

One PDF ( . pdf) file

coversheet. pdf

Task 1

Compulsory

One Haskell ( . hs) source file

task1 . hs

Task 2

Compulsory

One PDF ( . pdf) file

task2. pdf

If you are unable to submit your work due to technical difficulties, please submit your work via e- mail to [email protected] and notify the module leader (and ideally the setter, if different).

Any code will be tested on a Linux system equivalent to COMSC’s Linux lab machines and must run there.

3    Assessment Description

Consider the problem of solving a 2 × 2 Sudoku puzzle. It is played on a grid consisting of 4× 4 cells subdivided into four 2 × 2 squares as shown in the figure below. Some of the cells are empty, some of them are filled with digits from 1 through 4. The aim is to fill in the empty cells such that every row, every column, and every 2 × 2 square contains the digits 1, 2, 3, 4.

Task 1:   Write an efficient Haskell function

sudoku  p

that can solve this problem. Its input is a matrix, represented as a list of rows, where each row is a list of the numbers in the row. The numbers are either 1, 2, 3, 4 if the field is filled or 0 if the field is empty. The output of the function should be one solution to the problem, in the same matrix format with the 0 values replaced by a number 1 to 4 or an error if the input has no solution. For example, for the above grid, the input is

p  =  [[3,4,0,0],

[2,0,3,0],

[0,3,0,2],

[0,0,1,3]]

and one solution is

[[3,4,2,1],

[2,1,3,4],

[1,3,4,2],

[4,2,1,3]] .

Make sure you clearly document your approach and how to use your function in the comments.

Note, there are multiple, more or less efficient algorithms to solve this problem – make sure you clearly document your approach. Also note, you must write a function, not a full program (so no main, etc.) and it must have the above name with one argument.  Make sure your Haskell code can be compiled/interpreted without errors.

You must write your own code to solve this problem and not just call a library function, or copy code from some other source (you only get marks for your own work). You may of course use functions from the standard libraries listed in the Haskell 2010 language report.

Task 2:    Write a report of up to 400 words (this is an upper limit, not a target) as described below:

(a)  Discuss one feature of the functional programming paradigm that is useful to solve this prob- lem and compare it to another paradigm of your choice that does not have this feature.

(b)  Discuss one feature of the functional programming paradigm that makes it difficult to solve this problem and compare it to another paradigm of your choice that would make it simpler.

Clearly indicate which of the two points above you address. Make sure you discuss only one feature per point above; only the first feature you discuss for each point will be considered.


站长地图