首页 > 其他分享 >CPSC 219: Introduction to Computer Science II

CPSC 219: Introduction to Computer Science II

时间:2024-10-03 20:44:28浏览次数:6  
标签:code #..................# Introduction Science 219 will snake assignment your

CPSC 219: Introduction to Computer Science II

Assignment 1: Procedural Java – Snake GameCourse: CPSC233S24Due Date: Friday, Sept. 27, 2024

Version: 1.1.1 Weight: 10%

Objective:Write a Java program with a standard procedural structure and save the work to a repository.

Group Size: 1‐2

This assignment can be completed independently, or you may pair with another individual from the same tutorial.You and your partner must write all the code you submit. Refer to the plagiarism guide at the end of this documentfor more details. You and your partner should be able to answer any questions about the codebase and fullyunderstand what the code is doing. Individual marks may differ from the overall assignment grade based on howwell you can answer these questions. If working with a partner, you and your partner must submit a solution toD2L. If a Git repository is required, you may use thesame repository or separate repositories.TechnologyJava (JDK) 22, Git

Submission instructionsYou must submit your assignment electronically in D2L, commit it to a repository in GitLab (csgit.ucalgary.ca), and

have all of the TAs and instructors set as developers on the repository.

Submit your completed SnakeGame.java to D2L. Do not submit *.class files or any other files. Include your name

and UCID at the top (and your partner’s if you have one). Additionally, submit a text document with the link to

your repository (name the document gitlink.txt).

Please use the Assignment 1 Dropbox in D2L to submit your codebase. This submission must include all required

.java files, which will be listed later. If you complete this assignment with a partner, you and your partner must

submit the assignment to the Assignment 1 Dropbox in D2L.

In D2L, you can submit multiple times over the top of a previous submission. Do not wait until the last minute to

attempt to submit! D2L is notorious for glitches and hangups at the 11th hour.

Your assignment must be completed in Java (not Kotlin or others) and executable with Java version 22 (JDK 22).

You must only use standard libraries. Failure to submit the required .java files in D2L will be treated as a non‐submission for the assignment. TAs will not grade .class files and will not make requests for missing files. Do notsubmit complete IntelliJ project folders in D2L.OverviewYou will complete a Java program that simulates a simplified version of the classic Snake game. The game'sobjective is for the player to navigate the snake around a grid, eating food to grow longer while avoiding collisions

with the walls or itself. 代 写CPSC 219: Introduction to Computer Science II Your program must adhere to procedural programming principles and use global variablesto maintain the game state. You will create one Java file: SnakeGame.java. The program will be text‐based and

should use methods from both files to function correctly.

Game Description

In this simplified Snake game, the player controls a snake that moves around a grid. The snake grows longer each

time it eats food, and the game ends if the snake collides with itself or the walls.

Game Specifications:

GAME BOARD

The game grid will be 20 (wide) x 10 (tall), and the walls will be marked with ‘#’ symbols.

THE SNAKE

The snake is represented by one or more ‘S’ characters. Whenever the game starts, it should start at a random

location. When the game first starts, the length of the snake is 3. However, only the head is visible as the player

moves, the remaining segments of the snake become visible. Whenever the snake eats a fruit (the ‘@’) the snake

will grow in length (up to a maximum of 100 segments). If the snake hits a wall (the ‘#’) or itself the game ends.

The player can move the snake up, down, left, or right using the ‘w’, ‘a’, ‘s’, ‘d’ keys and they can quit the game

using the ‘q’ key.

FOOD

The food is represented by an ‘@’ character and appears at random locations, but it cannot appear on the snake

(S) or on the walls (#).

THE WALLS

The walls form the perimeter of the game board, and are represented by the ‘#’ symbol. The food and segments of

the snake cannot be on the wall. A segment of the wall must be at 0,0 (see achievements).EXAMPLE

Below is an example of the first few steps in the game:

####################

#..S...............#

#..................#

#..................#

#....@.............#

#..................#

#..................#

#..................#

#..................#

####################

Enter: w/a/s/d/q

s

####################

#..S...............#

#..S...............#

#..................#

#....@.............#

#..................#

#..................#

#..................#

#..................#

####################

Enter: w/a/s/d/q

s

####################

#..S...............#

#..S...............#

#..S...............#

#....@.............#

#..................#

#..................#

#..................#

#..................#

####################

Enter: w/a/s/d/q

s####################

#..................#

#..S...............#

#..S...............#

#..S.@.............#

#..................#

#..................#

#..................#

#..................#

####################

Enter: w/a/s/d/q

d

####################

#..................#

#..................#

#..S...............#

#..SS@.............#

#..................#

#..................#

#..................#

#..................#

####################

Enter: w/a/s/d/q

d

####################

#..................#

#.................@#

#..S...............#

#..SSS.............#

#..................#

#..................#

#..................#

#..................#

####################Requirements

Global Variables: Use global variables to maintain the game state, including the snake's position, the length of the

snake, and the game grid.Procedural Design: Your implementation must be procedural without custom classes and objects.

Documentation: Provide clear comments and documentation within your code explaining each function'sfunctionality and the program's overall structure.Display: in the console, display the game grid, the food and the snakeUser Interaction: Input commands to move the snake ('w' for up, 's' for down, 'a' for left, 'd' for right, ‘q’ to quit).Check for collisions and generate new food after the snake “eats” the existing food.

End the game when the snake collides with the walls or itself.The snake should start as three segments long and should “grow” (add another segment) each time after it “eats”the food.

A starting file has been provided for you. You must use the variables and methods present in that file (e.g.,

initializeGame()), but you can add any additional variables and methods you need.

Demonstration

You must demonstrate your assignment to the tutorial leader to receive a mark for this assignment. The tutorial

leader will ask questions to test your understanding of your submitted code. Your assignment will receive an F if

you cannot sufficiently answer any of the questions from a TA or instructor. A demo is required in order to receive

any grade for this assignment.

GradingYou will receive a B‐grade if you complete everything this assignment requires. You can complete additional

are designed to challenge you further and provide an opportunity to demonstrate a deeper understanding of thematerial and greater skill.The most important part of these assignments is your understanding of the code. You need to be able todemonstrate that you understand the code you are submitting. Failure to explain your code will be considered a

case of copying code from another source (ChatGPT, another student, etc.) and qualify for academic misconduct.B GRADE RANGE REQUIREMENTS:

Submission Complete: The assignment was submitted on time to D2L with all required files (SnakeGame.java and

gitlink.txt) and a link to GitLab with the TAs and instructor as developers.

Functionality: The program works as required and meets the specifications (initializing the game, displaying the

grid, moving the snake, and generating food).

Code Base: All of the required methods and variables are present and the code makes logical senseCode Documentation: Code is well documented.

Demonstration: The student satisfactorily answers the tutorial leader's questions about the code and clearlyunderstands the implementation.A GRADE RANGE REQUIREMENTSTo improve your grade beyond a B, you need to complete all of the tasks outlined in the B Grade Range

Requirements and the additional tasks below. The TAs will not help you with these.

Obstacles: Add random obstacles ('%') to the grid that the snake must avoid. These obstacles should not move but

provide additional challenges for navigation.

Wrap‐Around Movement: Implement wrap‐around movement so that the snake can move off one grid edge and

reappear on the opposite edge in areas with gaps in the wall (you will also need to implement the gaps in the wall).

C GRADE RANGE REQUIREMENTS

Submission: The assignment is submitted on time to D2L with all required files and a link to the repository with the

TAs and instructor as developers.

Code Explanation: The student satisfactorily answers the tutorial leader's questions about the code and clearlyunderstands the implementation.

One or more of the following apply:Limited Functionality: The game grid displays the walls, the food and the starting location of the snake, but otherfunctionality is missing or broken.Limited/No Documentation: Significant parts of the code are not adequately documented.Code Quality: The code breaks a few of the requirements(e.g., methods and variables required to be used, or isnot procedural, etc).D Grade Range

Significant portions of the program are missing or broken, however, required files were submitted. Explanations ofthe code are poor.

F GradeSubmission was missing or the student is not able to answer the questions of the TA adequately.LATE POLICY

The following late policy from SENG300 will be used if you are out of the five grace days:

assessment_grade = raw_grade * (1 – max(0, (hours_late ‐ 1) / 47))

This means there is a maximum of 1 hour grace period before the penalties begin. After 48 hours, the assignment

is worth 0.INCOMPLETEThis assignment will be marked as “Incomplete” if any of the conditions below apply to your assignment. If yourassignment is incomplete, you must submit the missing components within two days. Failure to submit incompleteassignment components will result in an (F) for that assignment. Each missing component will decrease your letter

grade for the assignment by half a letter grade step.

Incomplete conditions:

GitLab repo incomplete (missing link, TAs and instructor not established as a developer)

Required *.java files missing in D2L

Required *.java files missing in the repository

PlagiarismDiscussing the assignment requirements with others is reasonable and an excellent way to

learn. However, the work you hand in must ultimately be your work. This is essential for youto benefit from the learning experience and for the instructors and TAs to grade you fairly.Handing in work that is not your original work but is represented as such is plagiarism and

academic misconduct. Penalties for academic misconduct are outlined in the universitycalendar.

Here are some tips to avoid plagiarism in your programming assignments.

  1. Cite all sources of code you hand in that are not your original work. You can put the citations intocomments in your program. For example, if you find and use code found on a website, include a commentthat says, for example:# The following code is fromUse the complete URL so that the marker can check the source.
  1. A tool like chat‐GPT can be used to improve small code blocks. For example, five lines of code. If you gethelp from code assistance like Chat‐GPT, you should comment above the block of code you requestedassistance on debugging or improving and cite the tool used to get that suggestion. Using a tool like chat‐GPT to write the majority of your assignment requirements will be treated as plagiarism if found withoutcitation, and with citation, it will be treated as 0 for the component the student did not complete. Codeimprovement of short length will get credit if commented/cited properly.
  1. Citing sources avoids accusations of plagiarism and penalties for academic misconduct. However, you maystill get a low grade if you submit code not primarily developed by yourself. Cited material should never be used to complete core assignment specifications. Before submitting, you can and should verify anycode you are concerned about with your instructor/TA.Discuss and share ideas with other programmers as much as you like, but make sure that when youwriteyour code, it is your own. A good rule of thumb is to wait 20 minutes after talking with somebody beforewriting your code. If you exchange code with another student, write code while discussing it with a fellowstudent, or copy code from another person’s screen, this code is not yours.
  1. Collaborative coding outside your team is strictly prohibited. Your assignment submission must be strictlyyour code. Discussing anything beyond assignment requirements and ideas is a strictly forbidden form ofcollaboration. This includes sharing code, discussing the code itself, or modelling code after anotherstudent's algorithm. You cannot use (even with citation) anotherstudent’s code.
  1. Making your code available, even passively, for others to copy or potentially copy is also plagiarism.
  2. We will look for plagiarism in all code submissions, possibly using automated software designed for the
  3. Remember, if you are having trouble with an assignment, it is always better to go to your TA and/ornstructor for help rather than plagiarizing. A common penalty is an F on a plagiarized assignment.
  1. See the Course Outline for the policy on Generative AI use (such as ChatGPT). Generally, you can useChatGPT to help understand concepts and to debug code. Always cite your use of Generative AI andexplain what the code does.

标签:code,#..................#,Introduction,Science,219,will,snake,assignment,your
From: https://www.cnblogs.com/comp9021/p/18445461

相关文章

  • 学习笔记:A Introduction to inertial navigation
    3.2MEMS陀螺的误差特性本节我们分析MEMS陀螺中存在的误差,以及它们对积分后的信号(也就是旋转)的影响。3.2.1常量零偏角速度陀螺的零偏是它在不忍受任何转动时的平均输出,单位度每小时。如果对一个\(\epsilon\)大小的常量零偏进行积分,会导致一个随时间线性增长的角度误差:\(\theta......
  • CSCI1120 Introduction to Computing Using C++
    CSCI1120IntroductiontoComputingUsingC++,Fall2024/25DepartmentofComputerScienceandEngineering,TheChineseUniversityofHongKongCopyright©2024CSE,CUHKPage1of8Assignment2:GumballMachinesDue:23:59,Thu3Oct2024Filename:gumball.......
  • CITS2402 Introduction to Data Science
    CITS2402Introduction to Data ScienceSemester2, 2024AssignmentAssessed,worth 20%. Due: 11:59pm,Friday 4th  October 20241 AimThisassignmentaimstoinvestigatethesimilaritiesanddifferencesbetweenAustraliaandNew Zealand regarding......
  • 个人翻译Introduction to Linear Algebra, 5th Edition 10.2节(仅用于交流学习,非盈利)
    本书的翻译仅为交流学习!才疏学浅,不当的地方还望指正。请勿于其它用途!PDF文件 链接一:  https://pan.baidu.com/s/1ENKxfP_QJBaZHXlQ_xdxzw?pwd=9nej提取码:9nej 链接二:https://download.csdn.net/download/sinat_21706867/89817586以下只贴出本PDF截图 ......
  • CS 417/517: Introduction to Human Computer Interaction
    CS417/517:IntroductiontoHumanComputerInteraction Project1(Fall2024)1IntroductionInthisassignment,yourtaskistoimplementaConvolutionalNeuralNetwork(CNN)andevaluatetsperformanceinclassifyinghandwrittendigits.Aftercompleti......
  • COMP90049, Introduction to Machine Learning
    SchoolofComputingandInformationSystemsTheUniversityofMelbourneCOMP90049,IntroductiontoMachineLearning,Semester22024Assignment2:PredictingSupremeCourtRulingsReleased:Friday,September6th2024.Due:StageI:Friday,October4th5pm......
  • ECON 3720: Introduction to Econometrics
    ECON3720:IntroductiontoEconometricsProblemSet03FallSemester2024Due:September27th2024Pleasesubmittheproblemsetnolaterthan5PMonSeptember27th2024.SubmittheproblemsettoyourTA’smailboxintheMonroeHallbasement.Failureto......
  • Vulnhub靶机:The Ether: EvilScience
    0x01项目地址TheEther:EvilScience(v1.0.1)0x02靶机描述ThegoalistofindoutwhatTheEtherisupto.Youwillberequiredtobreakintotheirserver,rootthemachine,andretrievetheflag.目标是找出TheEther的意图。你需要侵入他们的服务器,获取ro......
  • Introduction to the YouTube to WAV Conversion Website
    Title:IntroductiontotheYouTubetoWAVConversionWebsite-www.youtubetowav.topIntoday'sdigitalage,whereweconsumeavastamountofmultimediacontent,havingtheabilitytoconvertvideosintodifferentformatscanbeextremelyuseful.One......
  • SIT742: Modern Data Science
    DeakinUniversityTrimester2,2024SchoolofITAssignment2UnitTeam:SIT742SIT742:ModernDataScienceExtensionRequestStudentswithdifficultyinmeetingthedeadlinebecauseofvariousreasons,mustapplyforanassignmentextensionnolaterthan......