代写COMP9021 Principles of Programming
科技
2024-04-13 ·
1
COMP9021 Principles of Programming
Term 1, 2024
Coding Quiz 6
Worth 4 marks and due Week 9 Thursday @ 9pm
Description
You are provided with a stub in which you need to insert your code where indicated without doing
any changes to the existing code to complete the task.
Given the value of seed and density, the provided code randomly fills an array (or grid) of size
10 x 10 with 0s and 1s.
Your task is to determine the maximum number of "spikes" in a shape.
A shape is made up of 1s connected horizontally or vertically (it can contain holes).
A "spike" in a shape is a 1 that is part of this shape and "sticks out" (has exactly one neighbour in
the shape).
Neighbours are only considered vertically or horizontally (not diagonally).
Note that a shape with a single 1 is also a spike.
See test cases below for more examples.2
Due Date and Submission
Quiz 6 is due Week 9 Thursday 11 April 2024 @ 9.00pm (Sydney time).
Note that late submission with 5% penalty per day is allowed up to 3 days from the due date, that
is, any late submission after Week 9 Sunday 14 April 2024 @ 9pm will be discarded.
Make sure not to change the filename quiz_6.py while submitting by clicking on [Mark] button
in Ed. It is your responsibility to check that your submission did go through properly using
Submissions link in Ed otherwise your mark will be zero for Quiz 6.
Test Cases
$ python3 quiz_6.py
Enter two integers, the second one being strictly positive: 0 8
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 0
0 1 1 0 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 0 1 1 1 1 1
1 0 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 0
1 1 1 1 1 1 1 0 1 1
The maximum number of spikes of some shape is: 13
$ python3 quiz_6.py
Enter two integers, the second one being strictly positive: 0 7
Here is the grid that has been generated:
1 1 1 1 0 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 0 1 1 1 1 1 1 1 1
1 0 1 0 1 1 1 1 1 0
1 1 1 1 1 1 1 1 1 1
1 1 0 1 1 0 0 1 1 1
1 1 1 1 1 0 1 1 1 1
1 1 1 1 1 1 0 1 1 1
1 1 1 1 1 1 0 0 1 1
1 0 1 1 1 1 0 1 1 1
The maximum number of spikes of some shape is: 3
$ python3 quiz_6.py
Enter two integers, the second one being strictly positive: 0 2
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 0
0 1 0 0 1 0 1 0 0 1
1 0 1 1 1 0 1 1 1 0
0 0 1 0 1 1 0 1 0 0
0 0 0 1 0 0 1 1 0 1
1 0 1 0 1 1 0 1 1 0
1 0 0 0 0 1 1 0 0 0
0 0 0 1 1 0 0 1 1 1
1 1 0 1 0 1 1 0 0 0
1 0 0 1 0 1 1 0 0 0
The maximum number of spikes of some shape is: 74
$ python3 quiz_6.py
Enter two integers, the second one being strictly positive: 0 4
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 1
1 1 1 0 1 1 1 0 0 1
1 0 1 1 1 1 1 1 1 0
0 0 1 0 1 1 1 1 0 1
1 1 1 1 0 0 1 1 0 1
1 0 1 1 1 1 0 1 1 1
1 1 1 1 0 1 1 0 0 1
1 0 0 1 1 1 1 1 1 1
1 1 0 1 0 1 1 1 1 0
1 0 1 1 1 1 1 0 0 1
The maximum number of spikes of some shape is: 8
$ python3 quiz_6.py
Enter two integers, the second one being strictly positive: 1 2
Here is the grid that has been generated:
0 0 1 0 1 1 1 1 0 0
1 0 1 1 0 1 1 0 0 1
0 0 0 0 1 0 1 0 0 1
1 0 1 0 0 1 1 0 1 0
0 1 0 1 1 0 1 1 1 1
0 1 0 1 1 0 1 1 0 1
0 0 1 1 1 0 1 0 1 1
0 0 0 0 0 0 1 1 1 1
1 0 1 0 0 1 0 1 1 0
1 1 1 1 1 0 1 1 0 0
The maximum number of spikes of some shape is: 55
$ python3 quiz_6.py
Enter two integers, the second one being strictly positive: 2 2
Here is the grid that has been generated:
0 0 0 1 0 1 1 0 0 0
1 1 1 1 1 0 0 1 1 1
1 1 0 0 0 0 0 0 1 0
0 1 0 1 1 1 1 1 1 0
1 1 0 1 1 1 1 1 1 1
1 1 0 1 0 1 1 1 1 1
1 0 1 1 0 1 0 0 0 0
0 1 0 0 0 1 0 0 0 1
0 0 1 1 0 0 0 0 0 0
0 0 0 1 1 0 0 0 0 1
The maximum number of spikes of some shape is: 46
Test Cases Explained
$ python3 quiz_6.py
Enter two integers, the second one being strictly positive: 0 8
Here is the grid that has been generated:
1 1 0 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 0
0 1 1 0 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 0 1 1 1 1 1
1 0 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 0
1 1 1 1 1 1 1 0 1 1
The maximum number of spikes of some shape is: 1
$ python3 quiz_6.py
Enter two integers, the second one being strictly positive: 0 7
Here is the grid that has been generated:
1 1 1 1 0 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 0 1 1 1 1 1 1 1 1
1 0 1 0 1 1 1 1 1 0
1 1 1 1 1 1 1 1 1 1
1 1 0 1 1 0 0 1 1 1
1 1 1 1 1 0
1 1 1 1
1 1 1 1 1 1 0 1 1 1
1 1 1 1 1 1 0 0 1 1
1 0 1 1 1 1 0
1 1 1
The maximum number of spikes of some shape is: 37
$ python3 quiz_6.py
Enter two integers, the second one being strictly positive: 0 2
Here is the grid that has been generated:
1 1 0
1 1 1 1 1
1
0
0 1 0 0 1 0 1 0 0 1
1 0 1 1 1 0 1 1
1
0
0 0
1 0 1
1 0 1 0 0
0 0 0 1 0 0
1 1 0 1
1 0 1 0 1 1 0 1
1
0
1 0 0 0 0 1 1 0 0 0
0 0 0 1 1 0 0 1 1 1
1 1 0 1 0 1 1 0 0 0
1 0 0 1 0 1 1 0 0 0
The maximum number of spikes of some shape is: 78
$ python3 quiz_6.py
Enter two integers, the second one being strictly positive: 0 4
Here is the grid that has been generated:
1 1 0
1 1 1 1 1 1 1
1 1 1 0 1 1 1 0 0
1
1
0 1 1 1 1 1 1
1 0
0 0 1 0 1 1 1 1 0
1
1 1 1 1 0 0 1 1 0 1
1 0 1 1 1 1 0 1 1 1
1 1 1 1 0 1 1 0 0 1
1 0 0 1 1 1 1 1 1 1
1
1 0 1 0 1 1 1 1 0
1
0
1 1 1 1 1 0 0 1
The maximum number of spikes of some shape is: 8
$ python3 quiz_6.py
Enter two integers, the second one being strictly positive: 1 2
Here is the grid that has been generated:
0 0 1 0
1 1 1
1 0 0
1 0 1 1 0 1 1 0 0 1
0 0 0 0 1 0 1 0 0 1
1 0 1 0 0
1 1 0
1 0
0 1 0 1 1 0 1 1 1 1
0 1 0 1 1 0 1 1 0 1
0 0 1 1 1 0 1 0 1 1
0 0 0 0 0 0 1 1 1 1
1 0 1 0 0 1 0 1 1 0
1 1 1 1 1 0
1 1 0 0
The maximum number of spikes of some shape is: 59
$ python3 quiz_6.py
Enter two integers, the second one being strictly positive: 2 2
Here is the grid that has been generated:
0 0 0 1 0 1 1 0 0 0
1 1 1 1 1 0 0
1 1 1
1 1 0 0 0 0 0 0 1 0
0 1 0 1 1 1 1 1 1 0
1 1 0 1 1 1 1 1 1 1
1 1 0 1 0 1 1 1 1 1
1 0
1 1 0 1 0 0 0 0
0 1 0 0 0
1 0 0 0 1
0 0 1 1 0 0 0 0 0 0
0 0 0 1 1 0 0 0 0 1
The maximum number of spikes of some shape is: 4
请加QQ:99515681 邮箱:99515681@qq.com WX:codinghelp
- 市场风向标WhatsApp工具成功博主推崇助你准确揭示市场趋势实现业务成功
- ins/ig群发推广营销软件,instargam2024最强营销工具推荐
- Telegram/TG群发拉群一体化解决方案,电报/TG营销优化工具,TG/纸飞机全能群发助手
- ins群发软件,2024年最新版协议上线欢迎联系天宇预约测试
- Instagram营销软件,ins最稳群发工具/ig群发引流必备神器
- 有知情人士透露,京东内部仍在频繁接触知名行业专家董宇辉
- Ins引流助手大揭秘,Instagram群发工具助你轻松拉群!
- 海外营销巨匠眼中的秘密武器 WhatsApp拉群工具为业务打造无与伦比的感官体验
- 美股三大指数涨跌不一,苹果放弃电动车计划涨0.8%
- 老杨第一次再度抓握住一瓶水,他由此产生了新的憧憬
- LitePoint、Morse Micro与AzureWave合作,推动Wi-Fi HaLow在工业物联网中的应用
- 新颖WhatsApp代拉群手段,让品牌在社交平台上引发热议
- 戴盟机器人发布Sparky 1:人形机器人两大阵营已现,要能跑能跳还是要心灵手巧?
- 转化巅峰 喜悦飞扬 WhatsApp拉群工具为你的销售数字添彩夺目
- 贵州桃花源新型材料有限公司负氧离子全屋整装增添了空间的独特韵味
- 全球市场大揭秘:海外营销专家亲授,WhatsApp拉群营销工具如何创造奇迹
- 会议电视重塑办公场景,皓丽创新大屏新体验
- Instagram群发消息工具,Ins模拟器群发软件,助你快速营销!
- 中国国际能源与埃尼集团在北京签署战略合作协议
- 鼎阳科技发布8GHz带宽12-bit高分辨率示波器,加速自身高端化进程
- 外贸新手必学WtApp工具轻松掌握市场动向事业腾飞
- ins协议私信新玩法!Instagram引流新方式,Ins一键消息发送助你轻松推广!
- 全球商谋 海外专家解密 WhatsApp拉群营销的国际化商业奥秘
- 业务高手求证 WhatsApp拉群营销工具究竟能不能成为业务腾飞的推动器
- 植物基等创新食品科技的机会与想象
- ins超好用群发神器!Instagram自动采集博主粉丝,Ins营销必备工具!
- instagram怎么自动采集博主粉丝?ins精准批量采集软件推荐
- ins营销软件,ins群发拉群助手,爆粉软件欢迎测试联系
- Instagram群发消息工具,Ins模拟器群发软件,助你快速营销!
- 曝光成都熠翊发服饰有限公司童装集合店用心铸就商业大楼
推荐
- 苹果罕见大降价,华为的压力给到了? 1、苹果官网罕见大降价冲上热搜。原因是苹 科技
- 升级的脉脉,正在以招聘业务铺开商业化版图 长久以来,求职信息流不对称、单向的信息传递 科技
- B站更新决策机构名单:共有 29 名掌权管理者,包括陈睿、徐逸、李旎、樊欣等人 1 月 15 日消息,据界面新闻,B站上周发布内部 科技
- 疫情期间 这个品牌实现了疯狂扩张 记得第一次喝瑞幸,还是2017年底去北京出差的 科技
- 丰田章男称未来依然需要内燃机 已经启动电动机新项目 尽管电动车在全球范围内持续崛起,但丰田章男 科技
- 老杨第一次再度抓握住一瓶水,他由此产生了新的憧憬 瘫痪十四年后,老杨第一次再度抓握住一瓶水,他 科技
- 智慧驱动 共创未来| 东芝硬盘创新数据存储技术 为期三天的第五届中国(昆明)南亚社会公共安 科技
- 如何经营一家好企业,需要具备什么要素特点 我们大多数人刚开始创办一家企业都遇到经营 科技
- 全力打造中国“创业之都”名片,第十届中国创业者大会将在郑州召开 北京创业科创科技中心主办的第十届中国创业 科技
- 创意驱动增长,Adobe护城河够深吗? Adobe通过其Creative Cloud订阅捆绑包具有 科技