Java代写:CS367PokemonGO


这次需要代写一个名为PokemonGO的游戏,当然没有Google的那么复杂,这个作业还是主要以练习List的使用为主。

Goals

The goals of this assignment are to:

  • Develop and run multi-class Java programs.
  • Use command-line arguments. (Eclipse: must set program configuration parameters.)
  • Use Linux to verity that your solution works on instructional machines.
  • Throw exceptions at the point the error is detected.
  • Catch exceptions where they can be handled as required by program specifications.
  • Perform console and file I/O.
    • Read text file input via java.util.Scanner
    • Write output to a text file via java.io.PrintWriter.

Description

For this assignment you will complete a simplified version of the video game
Pokemon Go. Rather than a video game, this program is console-based. In our
PokemonGo, the player (PokemonTrainer) encounters Pokemon in the wild and
tries to catch them to build his or her collection. The player may transfer
Pokemon to the Professor to earn candies.
Sometimes, Pokemon escape from the trainer and are not caught. A
PokemonTrainer has a Pokedex (list of Pokemon) which keeps track of which
Pokemon the trainer has encountered in the wild (including Pokemon that
escaped). The Pokedex stores data in the form of PokemonSpecies which contains
information such as the PokedexNumber and PokemonSpeciesName. If a Pokemon is
caught, then candies and the Pokemon itself are also stored.
Each Pokemon in the Trainer’s inventory has a certain level of combat power
which reflects its ability to win battles with other Pokemon. A player can
have multiple Pokemon of the same species but with varying combat powers (or
even multiple Pokemon of the same species with the same combat power).
The original game uses the same set of candies for PokemonSpecies of the same
evolution path. However, we simplify the game by maintaining number of candies
for each PokedexNumber. For example, in our version of PokemonGO, Bulbasaur,
Ivysaur and Venusaur (members of an evolutionary path) each have their own
candies rather than all of them being associated with Bulbasaur candies (as is
the case in the original game). In the original game, candies can be used to
evolve Pokemon, but we will not be implementing that functionality for this
assignment.
The game play allows the player to search for Pokemon (encounters), display
the Pokemon in their Pokedex (encountered Pokemon), display the Pokemon in
their inventory (capturedPokemon), transfer captured Pokemon, and quit.
At the end of game play, the player’s progress is saved. This allows the
player to resume playing at a later time.
Also, a few sample runs will be given. This is to help you get started fast.
But be careful, you may not change the design or interface of this program. If
you were to do so, grading tests will fail and you will lose a few or many
points.

Specifications

Program Start

Your program must require and accept one command-line argument. The single
command-line argument is the filename of a set of available Pokemon. This file
will be read into the main PokemonDB (database of Pokemon).

Program Play

  1. Prompt the player for their trainer name.
  2. Load or create the player’s Pokedex.
  3. Start main menu loop (for trainer interaction):
    * ‘s’ allows the player to initiate a search for a Pokemon.
    * ‘d’ allows the player to display a list of all the Pokemon they have encountered.
    * ‘c’ allows the player to display a list of only the Pokemon they have encountered and caught.
    * ‘t’ allows the player to transfer a Pokemon to the professor (for candy reward).
    * ‘q’ allows the player to quit and save their progress to an output file.
  4. Main menu loop ends when the player selects ‘q’ for quit.
  5. Player’s Pokedex inventory is saved (written) to a file for later use.

If the player enters ‘s’ to search, they will encounter a Pokemon. When a
Pokemon is encountered, the player is prompted to guess the Pokemon’s
PokedexNumber from a set of three options. If the player guesses correctly,
the Pokemon is caught; otherwise, the Pokemon has escaped.
The player receives 3 candies corresponding to the PokemonSpecies caught.
Along with the species data added to the Pokedex, the caught Pokemon itself is
added to the PokemonTrainer’s inventory. An escaped Pokemon’s species data is
still added to the Pokedex. However, since the Pokemon escaped, no candies are
obtained and it will not be available
for transfer.
Exceptions for invalid user inputs need to be handled appropriately using
constants from Config.java wherever applicable. After an encounter the play
returns with the main menu loop. The player is again prompted to search,
display Pokedex, display caught Pokemon, transfer a Pokemon, or quit.

Display All

If the player enters ‘d’ to display, an ordered list of names of
PokemonSpecies they have encountered is displayed (both captured and escaped
species).
After display, game play returns to the main menu loop. The player is again
prompted to search, display Pokedex, display caught Pokemon, transfer a
Pokemon, or quit.

Display Caught

If the player enters ‘c’ to display caught, an ordered list of the
PokemonSpecies they have encountered and captured is displayed. Only Pokemon
belonging to one of the displayed caught PokemonSpecies will be available for
transfer.
After display, game play returns to the main menu loop. The player is again
prompted to search, display Pokedex, display caught Pokemon, transfer a
Pokemon, or quit.

Transfer

If a player enters ‘t’ to transfer a Pokemon, the player is prompted to enter
the name of the PokemonSpecies he wishes to transfer. If he wishes to cancel
the transfer (and return to the main menu), he needs to enter ‘cancel’.
If the player does not have a Pokemon of the named PokemonSpecies, the
appropriate PokedexException is thrown and game play returns to the main menu
loop. If the player has a Pokemon of the named PokemonSpecies, then they are
prompted to provide the combat power of the Pokemon that they wish to
transfer. At this point if the player wishes to cancel the transfer, he needs
to enter ‘0’.
If the player does not have a Pokemon of the combat power that he entered, the
appropriate PokedexException is thrown and game play returns to the main menu
loop. If the player indeed has a Pokemon of the entered combat power, the
transfer succeeds and the player is awarded 1 candy of the corresponding
PokemonSpecies.
Exceptions for invalid user inputs need to be handled appropriately using
constants from Config.java wherever applicable. After transferring a Pokemon,
game play returns to the main menu loop (even if a PokedexException has been
thrown). The player is again prompted to search, display Pokedex, display
caught Pokemon, transfer a Pokemon, or quit.

Quit

Program ends when player selects ‘q’ for quit. At the end of program play, the
player’s current Pokedex is written to file. If that player (same name) plays
again, their Pokedex will be read into the program and they will be able to
continue where they left off.


文章作者: SafePoker
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 SafePoker !
  目录