CSE1OFX: Object Oriented Programming Fundamentals - Battleship Game - Computer Science Assessment Answer

Download Solution Order New Solution
Subject Code: CSE1OFX

Battleship Game - Computer Science Assessment Answer

Assignment Task: Task overview You are required to complete the tasks in the order below. Do not start a task until the preceding tasks are finished. Tasks 1-4: UML Create a complete UML class diagram in Visio 2016 for the Battleship Game. Marks will be awarded for the packages (Task 1), classes (Task 2), enumeration (Task 3) and relationships (Task 4). The marking rubric below gives more details about the components we are expecting. Task 5: Test scenario 1 Fill in a copy of the test case template (from the Learning Portal) for the test scenario of placing a fleet of ships with one ship only (the Aircraft Carrier, length 5) for the Player. place feet() method. This test scenario must cover the following test cases that generate valid outcomes: 1. Place the ship horizontally. 2. Place the ship vertically. ... and the following test cases that generate invalid outcomes: 3. Place the ship before the start of the grid. 4. Place the ship after the end of the grid. 5. Place the ship such that it is partially in the grid and partially outside of the grid. Task 6: Test scenario 2 Fill in another copy of the test case template (from the Learning Portal) for the test scenario of placing a fleet of ships with two ships only (the Aircraft Carrier, length 5, and the Battleship, length 4) for the Player. place feet() method. The test scenario must cover a minimum of two test cases that you design yourself. At least one test case must represent a valid outcome and at least one test case must represent an invalid outcome. Tasks 7-12: Implementation Implement the battleship game program as a NetBeans 8.2 project using Java 8. Your solution must also include the following general features: a) Error handling for user input. b) Consistent code indentation with one level of indentation per block. c) Code commenting for each class, all methods, and some inline comments. d) Good naming conventions. Marks will be awarded for the Coordinate class (Task 7), Player class (Task 8), HumanPlayer class (Task 9), ArtificialPlayer class (Task 10), BattleshipGame class (Task 11), and coding conventions (Task 12). Marks are not awarded for project organisation or the Ship class since these are provided in the starter code bundle (see “Solution design” above). Implementation tips for Tasks 7-12 So, what is the best way to get started with these tasks? In general, you should focus on implementing, testing and running small sections at a time. Do not write a large amount of code, then expect it to all run on your first try! In general, also be aware that some of the “junior” classes are there to help do the work of the “senior” classes. For example, the Player class is more “senior” than the Coordinate and Ship classes because it relies on those to do some of its smaller jobs. The below list is a suggested order for implementing the functionality of the assignment. Image credit: a) Open the starter code bundle provided (see “Solution Design” above). It comprises of two packages, implementation of the Ship class and placeholders for the remaining classes. b) Implement the Player. print can() method and dependencies first. Use a Player object in the battleship game.main() method to test this and by printing empty grids. Check that the output is in the same format as the examples in this assignment specification. c) Extend your work to implement the Player. place feet() method and dependencies next to place the Aircraft Carrier ship at a fixed location. d) Extend (c) to place the Aircraft Carrier at a random location instead. e) Extend (c) and (d) to place the other ships too. f) Have a go at HumanPlayer.takeGuess() and dependencies next to take one guess. Test your answer with a HumanPlayer object in BattleshipGame.main(). g) Like (f), work on ArtificialPlayer.takeGuess() next. h) Continue with battleship game.main() to start processing multiple guesses and the looping part of the program. i) Make BattleshipGame.main() finish at the right time with the help of Player.hasWon(). j) Complete any/all remaining work for Tasks 7-12. If you find that any of the methods are particularly long, you are welcome to introduce additional “helper” methods to break up your work. Lodge a support request if you would like some guidance. 11Task 13: Human versus computer game log Play a full game and save the output in a text file called “xxx_cse1ofx_assessment3_log1.txt” and include this with your submission. (xxx is your student ID.) This game log represents the output when running your solution to Tasks 7-12. Task 14: Battleship simulation extension Computer Science Assessment Task 15: Computer versus computer game log Play a full game and save the output in a text file called “xxx_cse1ofx_assessment3_log2.txt” and include this with your submission. (xxx is your student ID.) This game log represents the output when running your solution to Task 14. Task 16: Artificial intelligence extension Upgrade the take guess() methods of the ArtificialPlayer class to give the artificial player some “intelligent” guessing rather than random guessing. Here is a suggested rough and minimal implementation: 1. Scan the ocean for coordinates that have been hit and choose one adjacent coordinate (north, east, south or west) as the guess if available. Scan left to right and top to bottom. 2. If (1) fails, revert to random guessing. Put enough notes in the method header comment(s) of your code to describe the “intelligence” approach you implemented.
This Computer Science Assessment has been solved by our Computer Science experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.