CITS1001留学生 写作、Java语言程序、Java编程 辅导

” CITS1001留学生 写作、Java语言程序、Java编程 辅导UWA CITS1001 PROJECT 2 2020-S2Board Game – Tigers GoatsSeptember 30, 2020Version 1.0 – see revision date aboveCheck the LMS to ensure that you have the latest version. If you have any questions about any aspect ofthe project, submit them to help1001.1 Project Rules Submission deadline: 5pm Friday 23 October 2020 Submit via cssubmit Value: 25% of CITS1001 Project work to be done in pairs. You can find your assigned partner on csmarks. Project published: Wed 30 September 2020The project task is to construct a Java program containing your solution to the following problem. Youmust submit your program via cssubmit. No other method of submission is allowed. Only one submissionper team is required, but make sure it includes the names and student numbers of both partners.You are expected to have read and understood the UWA Policy on Academic Conduct. In accordancewith this policy, you may discuss with other students the general principles required to understand thisproject, but the work you submit must be the result of your own effort.You must submit your project before the submission deadline above. UWAs Policy on Late Submissionwill apply.2 Project OverviewIn this Java project, you will implement a very basic board game that allows a human player to playagainst the computer. You will use SimpleCanvas to display the board as the game progresses. To completethe project, first read and understand the problem specification in the next section. Then study thespecification of project classes to understand how your implementation is to be structured.A video of the game play (from the project solution) is provided on LMS.3 Problem DescriptionTigers Goats is a simple game where one player controls 12 goats to trap 3 tigers to win i.e. the tigersare unable make a valid move. The second player controls tigers to make simple moves or to jump over agoat to eat it and reduce their numbers. Tigers win when the number of goats becomes less than 6, sincethis is the minimum number required to trap all tigers. However, as the number of goats reduce from 12,their chances of wining diminish rapidly. Figure 1 shows a snapshot of game play in stage 2. The circlesrepresent goats and the squares represent tigers. One of the goats has been eaten and hence there are11 goats. Goats and tigers can move to an adjacent location connected by a straight line (red or white,1colour is only for cosmetic reasons). Valid locations (where a goat or tiger can be placed) are the cornersor intersection of lines.A tiger can jump over a goat in a straight line to the next location and eat the goat in its way. Thedestination location must be vacant for this to happen. In Figure 1, tiger 1 can jump over the goat to itsleft as shown by the arrow. The goat in the way will be eaten and removed from the board. Tiger 2 isblocked. It can neither move nor jump over (eat) any goat since there is no destination location to theleft, right or top and the bottom one is occupied by a goat. Goats can move to save themselves or theirfellow goats by occupying a location. Tiger 3 can eat the goat on its right.The game starts with an empty board. In the first phase, players place their pieces only. Player one(human) places 4 goats and then player two (computer) places 1 tiger. This process continues until 12goats and 3 tigers have been placed on the board. Moving a piece is not allowed in this phase. In thesecond phase, pieces can be moved only and no more pieces can be added to the board. Players takeone turn at a time from now on. Goats try to block the tigers and tigers try to avoid being blocked andeat goats. You are required to complete the Java classes so that a human player can play against thecomputer. The game should allow a human player to control the goats and should not allow the human tomake an illegal move. The game should automatically control the tigers implementing a simple strategyto win. This is not that difficult since the computer controls more powerful pieces i.e. the tigers. All ithas to do is to not miss any chance of eating a goat.4 Specification of Project ClassesIn Figure 3, I have made a simple 2-D coordinate system for the board using a fixed block size. Eachcorner or intersection of lines (called a location) is where a piece can be placed or moved to. Note thatnot all coordinates are valide locations e.g. there is no 1,2 or 1,3 location on the board to place a piece.There are 24 valid locations ([0] to [23]) that have been arranged in a 1-D array that start from the topleft and spirals inwards anti-clockwise. The 2-D coordinate system simplifies drawing of the board andpieces. The 1-D array representation of the board simplifies maintaining the location of pieces (tigers andgoats), deciding which moves are legal and which jumps (eats) by tigers are legal.The project is divided into 5 classes. One of them is SimpleCanvas which is provided to you. You do notneed to edit this class.1. GameViewer: This class controls the drawing of the board and game play. It implements a mouselistener to allow to human player to place goats and then to move them. It also checks that thegame rules a followed with the help of the GameRules class. It uses the Board class to maintain thestatus of the board and the AIplayer class to make the tiger moves. GameViewer also declares thewinner of the game.2. Board: This class maintains and updates the status of the board i.e. the locations of the tigers andgoats using a simple 1-D array of size 24 representing the valid locations of the board. This classhas accessor and mutator methods to query or alter the board at a specific location.3. GameRules: This class maintains the game rules (legal or illegal moves), turns (goats turn or tigersturn) and game stage (placement or movement of pieces). It also computes the nearest valid locationto a mouse click.4. AIplayer: This class controls the tigers aiming to eat a goat whenever possible. Otherwise, it makesa simple legal move or declares that it is unable to move any tiger.2Figure 1: Snaptshot of game play in the second stage where pieces can be moved only. Note that tiger 1and 3 can eat a goat as shown by the arrow and tiger 2 is blocked.You can choose your own colour scheme for the board, lines, pieces and text as long as they are visible.Further details on the functionality of the classes and their methods can be found the skeleton code providedas a zip file.No JUnit test classes will be provided as you can test your code visually by playing the game. For example,the goats should be placed so that they are exactly centred on the valid locations as long as the click wasin the vicinity of the location, it should not be possible to place a piece on top of another, the turns shouldfollow the game rules, the movement of goats/tigers should follow the game rules and so on.4.1 CreativityIt is best to implement the required functionality first. If you have time and wish to extend your knowledgeof Java, then you are encouraged to extend this project. A few suggested extensions are below: Blink the goat a few times before it disappears from the board after being eaten. Make the placement of the tigers more strategic rather than random. Animate the movement of goats and tigers instead of sudden disappear and reappear. Allow the human to choose and play tigers instead of goats. Implement an automatic player classthat places the goats and then moves them strategically to block the tigers and avoid being eaten.3Figure 2: Snaptshot of game play where the goats have won by blocking all tigers. The tiger can neithermove nor eat any goat.You can also identify and complete additional functionality as you wish. There are 30 marks for additionalfunctionality. These are not easy to get marks. If you implement all of the above and the goats can beata casual human player, you will get all 30 marks. However, these marks can only make up for marks thatyou have lost in this project or elsewhere. You cannot get over 100 marks in this unit.5 Project Management TipsBefore starting the project, students are expected to have studied the lectures and the relevant chapters of the text, completed the assigned labs during Weeks 2-9, read and understood the whole of this project description, read and understood all relevant UWA policies.The Game of Life lecture and the Fifteen Puzzle lab will be helpful.It is recommended that you tackle the project tasks in the order indicated; that you compile frequently;and that you test and run the code after completing each method, to ensure your code behaves as youthink it ought. If you are stuck on a method, it is often a good idea to look in the lecture material, text4Figure 3: The board is represented by a 2D coordinate system using steps of block size. The top leftcorner is 0,0 and the bottom right corner is 8,8. Not all coordinate locations are valid. For example, 1,2is not a valid location to place a piece. There are 24 valid locations on the board.book or lab solutions.You can gain good marks even if you do not complete all the methods, so long as the code you have writtencompiles and runs correctly. But if you submit a large body of code that does not compile or that crashes,then few marks can be awarded.5.1 HelpTimetabled lab sessions will run as usual during the project weeks and facilitators will be available to helpyou at any of the lab sessions per week (see the CITS1001 timetable for lab time details). Remember thisproject is to be done in pairs. Besides your project partner, you may discuss with the facilitators andother students the general principles required to understand this project, but the Java code you submitmust be the result of your own effort (the two team members). Suspected academic misconduct will bereferred to the Academic Conduct Advisor for formal review.Post any questions or requests for clarification to help1001 but do not post any project code on help1001.55.2 Hints and TipsHints and tips about the various methods may be uploaded here from time to time. Whenever that happens,the document version number will be updated.1. In addition to following the TODO sequence, try to implement one functionality, from game playpoint of view, at a time. For example, placement of goat, placement of tiger, movement of goat(legal or illegal move), make a simple tiger move (legal of illegal), allow only legal moves and test ifall tigers are blocked.2. You may need to implement a simpler version of a complicated method first and then revisit thatmethod to add more functionality.3. The formula for calculating the distance between two points (x1, y1) and (x2, y2) isd =q(x1 x2)2 + (y1 y2)2.6 Project SubmissionSubmit the following .java source files on cssubmit:1. GameViewer.java2. Board.java3. GameRules.java4. AIplayer.java5. (Optional) Any additional class that implements additional functionalityDo not submit anything else. No other method of submission is allowed. Only one submission per teamis required, but make sure it includes the names and student numbers of both partners on every.java file.The file names, class names, and method signatures in your submitted code must match the original specificationsexactly. Any changes you make which complicate the marking process will be penalised. If yourcode cannot be compiled, your submission will be penalised. It is OK to add other methods if you like, solong as you do not change the signatures of existing methods.Common mistakes are to submit .class files in place of .java files, or jar files. If you do one of these (orsomething similar), you will be notified by email as soon as we become aware, but you will be due for anyapplicable late penalty up to the time you re-submit. cssubmit makes it easy to check your files after youhave submitted them – do it!67 AssessmentYour submission will be assessed on completeness: how many of the methods you have written according to the specifications; correctness: whether your methods implement the specifications exactly; clarity: whether your code is clear to read and well-constructed. There are dedicated marks for(1) clarity and efficient use of variables, (2) clarity and efficient use of if if-else constructs, (3)efficient use of loops. additional creativity: any extensions you make to the specified project.Inside the project zip folder, there is a marks distribution.xlxs file that contains detailed marks distribution.This is the file that you will receive as feedback. If a method works perfectly, you get full marks forthe method but there are 30 marks reserved for clarity and efficiency. You may lose marks here.Good Luck!Professor Ajmal MianUnit coordinator如有需要,请加QQ:99515681 或邮箱:99515681@qq.com

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导