Computer Science Question

Description

Having Trouble Meeting Your Deadline?

Get your assignment on Computer Science Question  completed on time. avoid delay and – ORDER NOW

Maze – Starter CodeTests.java – Test Methods

Maze – Starter CodeTests.java – Test Methods

https://drive.google.com/drive/folders/1I8cvFjGW7M…

Purpose

As a reminder, the purpose of this task is to apply the programming skills you have acquired to a practical and in-depth project. In this assignment, you will practice designing and using methods, strings, and 2D arrays.

If you are having trouble getting started, review the material and think about how you can use each concept to accomplish your goals. We recommend reviewing the following sections: 4.0: Defining and Using Methods; 4.1: Methods That Return Values; 5.3: Multidimensional Arrays; 5.4: Traversing 2D Arrays; and 6.1: Comparing and Manipulating Strings.

Task

OUTLIER ODYSSEY

Your ultimate goal is to build a game called Outlier Odyssey. In this game, a player will navigate a two-dimensional map from one corner to another with limited resources while encountering hazards. During each part of the project, you will build an aspect of the game. Code from a given part may be reused in the following parts.

PART TWO: MAZE

For this assignment, you will complete a game where a player moves from the top left-hand corner of a 2D board to the bottom right-hand corner without running out of health. To accomplish this, you will place hazards in the maze, check player movement validity, and develop player-board interaction. This assignment is expected to take 4-6 hours.

Running the Game

The maze is a 2D String array. The game will start with a reserved cell for the player (P) and one random cell containing a magical gem (GEM)! Every other cell will be randomly assigned to one of the following hazards: wolf, bear, elk, or hare.

The player starts in the top-left corner with 50 health and must travel to the bottom-right corner without running out of health. For each turn, the player can move up, down, left, or right. After selecting a direction, the player is given a preview of the hazard in the chosen cell. Then, they can confirm the move or opt out and choose a new direction.

As the player traverses the maze, their health changes according to the hazards they reach. Once the player has visited a cell, the cell value changes to “X”—the hazard has been neutralized and the player can revisit the cell without any change in health.

The game ends when the player reaches the bottom right-hand corner of the maze or when they run out of health!

Implementation

You will be responsible for completing three methods: init(), validMove(), and makeMove(). Additional methods drawBoard() and runGame() have been completed for you. We have provided a second file, Tests.java, that can provide feedback on the init() and validmove() methods. You do not need to make any revisions to or submit Tests.java! To use the tests, make sure Tests.java is uploaded to your Repl.it. Then, uncomment the method calls in the main method. When you are ready to test all three methods, use runGame() and compare your output to the sample run.

Note: Tests.java is intended to help catch major issues. A successful test does not guarantee full credit.

METHOD ONE: init()

The init() method initializes the game board. It accepts a 2D String array as an argument and modifies that array directly to add values. The board is initialized in three steps:

  1. Randomize placement of a wolf (“Wolf”), boar (“Boar”), elk (“Elk”), or hare (“Hare”) for every cell
  2. Reserve the top-left board square for the player
  3. Randomly place a gem (“GEM”) in one non-player square

Steps 2 and 3 have been completed for you. To finish the method, add code to randomly place hazards. For each cell, use the useful code snippets to generate a random number between 0 and 4. Then, assign the cell to a hazard based on the randomly generated number based on the table below. Make sure to capitalize the first letter of each hazard!

Randomly generated number 0 1 2 3 or 4
Hazard String “Wolf” “Boar” “Elk” “Hare”

METHOD TWO: validMove()

validMove() ensures the player is not trying to move out of the maze (out of the bounds of the 2D array). It returns a 1D array using the following logic:

  • Accept a char representing the direction the user wants to go (‘l’ for left, ‘r’ for right, ‘u’ for up, ‘d’ for down) as well as:
    • The 2D String board array
    • The current player position
    • A 1D array that stores the coordinates of the next move
  • Check the current player location on the board to decide if the requested move is valid (is within the bounds of the board)
  • Modify the 1D array nextCell to:
    • The coordinates for the next cell if the move is valid
    • {-1, -1} if the move is not valid

METHOD THREE: makeMove()

Once a move has been validated, makeMove() implements the player movement. This is a more complex version of the player movement from Gem Run! makeMove() should complete three tasks:

  1. Change the String in the current player cell (the cell the player is leaving) to “X”
  2. Update the player position to the nextCell coordinates
  3. Return an int corresponding to the health cost of the new cell depending on the hazard it contains; this value can be negative or positive according to the following table:
Hazard Wolf Boar Elk Hare Gem Already visited
Health -20 -10 -5 +10 x 100 0

Criteria

You will be graded on the criteria in the rubric linked below. The purpose of this rubric is to help you understand the expectations for the assignment and improve your work. Before beginning the assignment, read the rubric to understand the criteria you will be graded on. Before you submit your assignment, use the rubric as a guide and test your program.

Tips and Tricks

Start early and take breaks. Fresh eyes are the best for debugging.

Use our useful code snippets. This project requires you to work with some external tools. You do not need to work these out for yourself!

Work one step at a time! Tackle each step in order. This assignment has three methods; take it slow and finish one before starting the next.

Test frequently and repeatedly. A small, early issue can cause big problems later.

Ask for help when you need it. If you are stuck, reach out to your instructor or use the discussion boards.

Want to keep going? Try some extra challenges! Make sure your submitted code does not include any of these extra implementations.

STARTER FILE(S): Maze – Starter Code

.

Tests.java – Test Methods

.

That’s what I did for part Part 1:

.

https://drive.google.com/drive/folders/1I8cvFjGW7M…

Explanation & Answer

Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Order Now and we will direct you to our Order Page at Litessays. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.

Do you need an answer to this or any other questions?

Similar Posts