Java代写:CS416 Location based Strategy Game Part 2

代写一款Location-based game,接着上次代写第二部分的工作。

Location-based game

Introduction

In this project you are creating a Java application which is built using the Maven build system. We will begin by using Eclipse to create the project structure.

Getting started

If you are working on your own laptop you should begin by downloading Eclipse, if you do not already have it. Download it from https://www.eclipse.org. On DICE, Eclipse is available via the eclipse command.

Next, create a new Maven project in Eclipse by choosing File New Project . . . , and choosing Maven
Project as the option. Leave unchecked the option which reads “Create a simple project (skip archetype selection)”; this is unchecked by default. On the following page, choose the archetype “maven-archetypequickstart” (this is the default).

Find “JRE System Library” in the Package Explorer and select “Properties”. Change “Execution environment” to be “JavaSE-1.8”.

You should now have a working Maven project structure. Note that there are separate folders for project source and project tests. Note that there is an XML document named pom.xml where you can place project dependencies. Two Java files have been automatically generated for you: App.java and AppTest.java.

Setting up a source code repository

(This part of the practical is not for credit, but it strongly recommended to help to protect you against loss of work caused by a hard disk crash or other laptop fault.)

In the Informatics Large Practical you will be creating Maven project resources such as XML documents and Java files which will form part of your implementation, to be submitted in Coursework 2. We recommend that these resources be placed under version control in a source code repository. We recommend using the popular Git version control system and specifically, the hosting service GitHub (https://github.com/). GitHub supports both public and private repositories. You should create a private repository so that others cannot see your project and your code.

Check your current Maven project into your GitHub repository. Commit your work after making any significant progress, trying to ensure that your GitHub repository always has a recent, coherent version of your project. In the event of a laptop failure or other problem, you can simply check out your project (e.g. into your DICE account) and keep working from there. You may have lost some work, but it will be a lot less than you would have lost without a source code repository.

A tutorial on Git use in Eclipse is here: https://eclipsesource.com/blogs/tutorials/egit-tutorial

The implementation task

For this first coursework of the ILP you are to implement a critical part of PowerGrab game, the function which calculates the immediate next position of the drone, given the current position and the direction of flight. Your implementation will be judged on three criteria: correctness, readability, and efficiency.

Your implementation must have a package named with a class called Direction, which defines constants:

Direction.N,
Direction.S,
...

and so on for all sixteen compass directions used in this practical. This class does not have any other functionality.

Your implementation is also to contain another class named Position, as outlined below.

Your class can contain other fields, other constructors, and other methods, but it must contain those listed above, and they must be individually labelled as public so that they are visible outside the current package. Your submission can contain any other classes which you have implemented; these will be ignored in this coursework because our interest here is only in the class Direction and the class Position.

The method nextPosition in the Position class is to implement the function which returns the next position of the drone when it makes a move in the specified compass direction. (Refer to Figure 5 for the specification of this function, remembering that the drone travels 0.0003 degrees in a move. I.e. r = 0.0003.)

The method inPlayArea tests whether or not this Position lies in the PowerGrab play area as specified in
Figure 3 of this document.

To help you with getting the nextPosition and inPlayArea methods correct, a set of unit tests will be made available from the ILP course web page in the file AppTest.java. Your nextPosition and inPlayArea methods should pass all of these tests.

Preparing your submission

Make a compressed version of your powergrab project folder using ZIP compression.

  • On Linux systems use the command zip -r powergrab.zip powergrab .
  • On Windows systems use Send to ] Compressed (zipped) folder.
  • On Mac systems use File ] Compress “powergrab”.

You should now have a file called powergrab.zip.

How to submit

Please submit your implementation work from your DICE account using this command:

submit ilp cw1 powergrab.zip

In order to streamline the processing of your submissions, and help avoid lost submissions, please use exactly the filename powergrab.zip. The archiving format to be used is ZIP only; do not submit TAR, TGZ or RAR files, or other formats.

Allocation of marks

A total of 25 marks are allocated for Coursework 1 according to the following weighting.

Correctness (15 marks)

Your function should be a correct implementation of the “next position” function for the drone, giving the correct next position for all sixteen possible compass directions.

Readability (5 marks)

Your function should be clear and concise. The implementation of the Direction and Position classes should be readable and clear.

Efficiency (5 marks)

The “next position” function will be executed multiple times in the PowerGrab game, and while testing the game, so it is important that it should be efficient. The game development team have not yet decided on the Java compiler which will be used to compile the release version of the game, so the compiler optimisations which will be applied are not yet known. The safest assumption in this setting is to assume that the compiler will not optimise your function at all and that you should explicitly code any optimisations which can be made to the “next position” function.