COMP1039代做、代写Java程序语言
COMP1039 Coursework 2 (15 Marks)
Release Date: 8 April 2024 18:00
Deadline: 6 May 2024 18:00
Your Task
A farmer with his wolf, goat, and cabbage come to the edge of a river they wish to cross. There is
a boat at the river’s edge, but, of course, only the farmer can row it. The boat also can carry only
two things (including the rower) at a time. If the wolf is ever left alone with the goat, the wolf will
eat the goat; similarly, if the goat is left alone with the cabbage, the goat will eat the cabbage.
Implement the problem in Haskell, and use a search algorithm to find the solution.
Suppose that the function is called solutionPath. The initial state is ['w', 'w', 'w',
'w'], in which the four w’s represent the position of the farmer, wolf, goat, and cabbage
respectively, at the west bank of the river. The final state is ['e', 'e', 'e', 'e'] in which
the four e’s represent the position of the farmer, wolf, goat, and cabbage respectively, at the east
bank of the river.
We can apply the function to find the solution path as follows:
solutionPath [['w', 'w', 'w', 'w'], ['e', 'e', 'e', 'e']]
One possible returned solution path is as follows:
The solution path is interpreted as follows:
[ F, W, G, C ] [ Farmer, Wolf, Goat, Cabbage ]
['w', 'w', 'w', 'w'] Farmer, Wolf, Goat, and Cabbage are at the west bank of the river
['e', 'w', 'e', 'w'] Farmer takes the Goat across to the east bank
['w', 'w', 'e', 'w'] Farmer returns to the west bank alone
['e', 'e', 'e', 'w'] Farmer takes the Wolf across to the east bank
['w', 'e', 'w', 'w'] Farmer returns with the Goat to the west bank
['e', 'e', 'w', 'e'] Farmer takes the Cabbage across to the east bank
['w', 'e', 'w', 'e'] Farmer returns alone to the west bank
['e', 'e', 'e', 'e'] Farmer takes the Goat across to the east bank
Finally, all four of them are at the east bank.
Your Submission
Please ensure that your report is formatted in Microsoft Word and contains the following sections:
Section A: Solving the Farmer Crosses River Puzzle using State Space Search (4 marks)
In this section, provide an explanation in no more than 500 words on how you can solve the Farmer
Crosses River puzzle using the state space search problem-solving technique. Utilize a figure to
illustrate clearly how your search algorithm traverses either a tree or a graph.
Section B: Haskell Source Code (4 marks)
Include your Haskell program without any remarks/comments. Your program will be evaluated
based on the following criteria:
• Correctness: The program should produce the required output with correct input.
• Conciseness: Aim for brevity while ensuring the program meets the required specifications.
• Adherence to Functional Programming Practices: The code should follow good functional
programming practices.
• Utilization of List Structure: Represent the problem states using list structure ([F, W, G, C]
as demonstrated).
Section C: Experimentation with the Program (Input-Output Sessions) (4 marks)
Include up to 5 screenshots showcasing the output of your experiments. These screenshots should
depict the solution paths generated when given initial and final states as input. Your program will
be assessed based on the following features:
• Ability to generate all possible solution paths, representing safe ways of crossing the river.
• Effective functionality even when one or two of the wolf, goat, or cabbage are already on
the opposite side of the river.
• Identification of the shortest solution path.
• Ability to inform the number of trips required to get everything across the river safely.
Section D: Discussion on Solving the Same Problem in OOP Way (3 marks)
Provide an explanation in no more than 300 words on how you can solve the Farmer Crosses River
puzzle in Object-Oriented Programming way using Java. You should compare and contrast them
in terms of programming styles (not syntax), such as inheritance, polymorphism, function
overloading, as well as the imperative and declarative nature of the paradigms.
Submission Instructions
There are two files to be submitted: a report in Microsoft Word (e.g., Report.docx), and a Haskell
program source file (e.g., Farmer.hs). Please ensure that all your files are compressed into a single
zip file. The file should be named according to the following format: STUDENTID_NAME.zip
(e.g., 20514000_Danting_Wang.zip).
Once your files are organized and zipped, submit the zip file onto the Moodle page. Note that each
subsequent submission will overwrite the previous one. If you submit multiple times, please verify
that your last submission includes all the necessary files.
After submission, please review your submission to ensure that it is complete and executable. Past
experiences have shown that submitted files may occasionally be corrupted. You will receive a
zero mark if your submitted file is corrupted or not executable.
For late submissions, the standard late submission policy applies, resulting in a 5% deduction for
every 24-hour period, including weekends and public holidays.
Plagiarism
If you utilize code sourced from a textbook or the internet, you must acknowledge its origin.
Plagiarism detection tools will be employed to check for similarities between submissions and the
online content. We would like to remind you of the School's Policy on Plagiarism. While recent
advancements in AI and large language models (LLMs) such as ChatGPT have presented good
opportunities of using them, it is crucial to note that the University considers the use of such
technologies as potentially constituting misconduct.
Recommended Learning Materials
Welcome to the Farmer, Wolf, Goat, and Cabbage Problem
https://www.d.umn.edu/~gshute/cs2511/slides/javascript/code/solve/solve.html
There is a simple animation to help you understand the Farmer Crosses River puzzle better, before
you start to implement a solution.
AI Algorithms, Data Structures, and Idioms in Prolog, Lisp, and Java
https://www.cse.sc.edu/~mgv/csce580sp15/Luger_0136070477_1.pdf
There is a good discussion about implementing the Farmer Crosses River puzzle using Prolog
(logic programming), Lisp (functional programming), and Java (object-oriented programming).
Graph theory: wolf, sheep and cabbage
https://www.youtube.com/watch?v=pBT-8gqhHzo
This videoclip provides a simple and easy to understand presentation on how to solve the Farmer
Crosses River puzzle using a graph search method.
Goat, cabbage, wolf
https://www.uni-weimar.de/fileadmin/user/fak/medien/professuren/Webis/teaching/ws14/searchalgorithms/wolf-goat-cabbage.html
There is a good discussion on how to formulate the Farmer Crosses River puzzle as a search
problem.
A little bit of Lisp
There is a discussion about the Farmer Crosses River puzzle in Lisp.
请加QQ:99515681 邮箱:99515681@qq.com WX:codinghelp
- Instagram出海营销引流策略分享,ins群发引流吸粉攻略
- 代做scheduled processor
- WhatsApp群发软件/ws群发/ws代发/ws协议号/ws劫持号
- 新质生产力发展划重点,第十二届上海国际泵阀展预登记“福”力全开!
- 在没有LINE工具的日子里,我的业务就像是一朵不开花的枯草
- Instagram自动登录 - ins群发工具/ig营销助手/ins引流神器/独家引粉
- 超越期望 定制体验 WhatsApp拉群工具如何满足每位用户的个性诉求
- 聊城物流网:连接世界的物流枢纽,助力城市腾飞
- Telegram营销软件群发引流神器,TG营销引流一键搞定
- 代做Real-time 2-D Object Recognition
- 常州威雅:再传喜讯!入选Spear’s杂志亚太地区最值得推荐的14所学校之一
- 碧桂园服务助农|心选X 秭归县农业农村局首场溯源圆满收官!
- 头部CRO新药研发公司项目管理都在用什么软件
- 趣丸集团荣获2023年福布斯中国最佳创新实践雇主
- Ins/Instagram群发私信打粉软件推荐,ins好用的营销利器!
- Instagram营销软件,ins如何采集粉丝/博主进行私信群发
- 没用WhatsApp拉群工具之前 我的工作就像是一场无休无止的奔波
- 网络通信新标杆:WhatsApp协议号推广引领未来!
- program代做、代写R编程语言
- WhatsApp全球混合协议号/ws群发教学/ws频道号
- Ins定位采集,Ig私信博主,Instagram群发营销助手
- Instagram私信博主 - ins自动登录/ig采集指定地区/ins群发软件
- 埃及#Telegram协议号-telegram劫持号-稳定耐用量大价稳!Line群发云控助您从容面对大规模推广任务
- 库位管理革新:迈尔微视3D视觉为智能仓储注入新活力
- 热血开局 2024DMS中国职业赛在上海成功举办
- MAX6418UK31+: Ensuring System Stability with Ultra-Low Power Microprocessor Reset Circuits | ChipsX
- 代写COMP222、代做Python, Java编程
- MAXHUB牵头编制《“领跑者”标准评价要求 会议平板》团体标准
- 电报/纸飞机自动群发拉群软件,Telegram全球定位采集工具
- Instagram批量养号 - ins自动登录/ig采集指定地区/ins群发软件/ig博主私信
推荐
- 老杨第一次再度抓握住一瓶水,他由此产生了新的憧憬 瘫痪十四年后,老杨第一次再度抓握住一瓶水,他 科技
- 升级的脉脉,正在以招聘业务铺开商业化版图 长久以来,求职信息流不对称、单向的信息传递 科技
- 如何经营一家好企业,需要具备什么要素特点 我们大多数人刚开始创办一家企业都遇到经营 科技
- B站更新决策机构名单:共有 29 名掌权管理者,包括陈睿、徐逸、李旎、樊欣等人 1 月 15 日消息,据界面新闻,B站上周发布内部 科技
- 创意驱动增长,Adobe护城河够深吗? Adobe通过其Creative Cloud订阅捆绑包具有 科技
- 苹果罕见大降价,华为的压力给到了? 1、苹果官网罕见大降价冲上热搜。原因是苹 科技
- 智慧驱动 共创未来| 东芝硬盘创新数据存储技术 为期三天的第五届中国(昆明)南亚社会公共安 科技
- 丰田章男称未来依然需要内燃机 已经启动电动机新项目 尽管电动车在全球范围内持续崛起,但丰田章男 科技
- 疫情期间 这个品牌实现了疯狂扩张 记得第一次喝瑞幸,还是2017年底去北京出差的 科技
- 全力打造中国“创业之都”名片,第十届中国创业者大会将在郑州召开 北京创业科创科技中心主办的第十届中国创业 科技