Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In java Implementale adventure game that consists of a player wandering in 10x10 gid based game world. The player is located at a point with

In java image text in transcribed
image text in transcribed
Implementale adventure game that consists of a player wandering in 10x10 gid based game world. The player is located at a point with intester coordinates and faces northeast, south, or west. The start out at position 0,0 The player can turn it or kit and can move forward in the direction they are facing, one step at a time. They cannot mave of the 10:30 am world, thout Any spot in the game world may contain a trao andora jetpack, or nothing If a player encounters a jet puck, they will pick up the jet pack. But they can only hold toto jet packs at a time, soit they already have 3 jet packs and they encounter another one, they cannot pick it up if a player encounters a trao they wil alin. If they have at least one jetpack, they can use it to get out of the trand save themselves. If they do not have any jet packs, they die and lose the same Ita player is able to make 30 moves without dring. They win the game. Note that a move bere includes moves forward only, not tuming rigt/left Use this template Aventure care a Notes: . Do not worry about how the cameresoods after there is a win or lose. Assame no methods will be called after a win/ess the same is over . When you print out messages use print, NOT printint Otherwise your tests may not pass during radine Examples SCPoint szap - new ArrayListo espedid new Fon(-1.0 apa.dina Pot (4) posode Pint().-21 traps.add(new Point(-3,-11) srap.add new Point(-4-1) Bistroint> jetacks - new talis achackadd neu Doint co. 1) jechackeadinou point-2,5 cesadden toist (-3) tee - Toyce (prije game,gatPlayerLocation | | | returns , ganet.getPlayerDirection>://cotans WTS game movelayer (3) Prints out "picked up jet packt gamel.galaystacation on 0,1 gamel.et layer to secure game playerunt gamalga layuncation // returneo, 1 Ont.getElayedirection) // EST gamal.novlayer (1) gamel.getPlaystation // returns -1, 1 gamt.getElayerDirection): returns HEST" garsol.playerunter samel.getPlayeztecat. Peruens - 1 gane.ge layerDirection con samallayor Bits out into a trap Biodat pokl a.tlagertocation: Watutn 1.0 atteet PlayerDirecties) // return "SOUTS" gamal.playerTurnight gatrets getEleverlesation : 44 retute -1, Q. yamel.getzlayerDirection); // returns "REST camel. Dlayer Qamet pelayettocation sets -2.0 gamal.gottayo // toturns HET novesayer gomet.etPlayer tocation : 1/ return -3.0 game gtPlay wri Gian 4 | teaETLE "HEET" Gamal.playerurtat gamel.getElayectocations // returns -3.0 gana.gablayerDirection et "TH ameloveyor Trints out all into trap! You lose je import java.awt.Point: SI sy A class for an adventure game with a player, traps, and get packs. The #world measures 30 x 1e, and the center of the world is at coordinates o, e. 20 public class AdventureGame 23 ADD YOUR INSTANCE VARIABLES HERE 13 " 15 Constructs with player location, (in the center of the world facin north, with the traps and get packs civen 17 18 astraps list of location of traps (assume all within world bounds, 19 and not a.) 20 Bare detracks list of locations of det packa (assure all within world bounds, and not at. ) * public AdventureGame(List Point> traps, List Point> JetPacks) 24 // FILL IN 25 > 16 21 26 20 Turn the player to the left . public void playerTurnleft() 1 FILL IN > 4 37 Turn the player to the right public void playerTurnright() { 1 FILL IN > 42 45 88% $ Moves the player one step in the wirection they're facing as long as the move 15 a valid one within the bounds of the world) public void movePlayer() 1/ FILL TH > 4 49 50 51 57 55 56 57 Return the player's current location return the player's current location */ public Point getPlayerLocation) return null; // FX > 59 63 4 65 56 67 Returns the direction in which the player is currently facing (NORTH,soun, "AT", OST) return the direction in which the player is currently facing public string getPlayerDirection() { return; // FIXE > 21 72 7 75 76 * Returns the number of moves the player has taken return the sumber of moves the player has " public int get ovestade() { return -1; // FIX ) 20 30 39) Implementale adventure game that consists of a player wandering in 10x10 gid based game world. The player is located at a point with intester coordinates and faces northeast, south, or west. The start out at position 0,0 The player can turn it or kit and can move forward in the direction they are facing, one step at a time. They cannot mave of the 10:30 am world, thout Any spot in the game world may contain a trao andora jetpack, or nothing If a player encounters a jet puck, they will pick up the jet pack. But they can only hold toto jet packs at a time, soit they already have 3 jet packs and they encounter another one, they cannot pick it up if a player encounters a trao they wil alin. If they have at least one jetpack, they can use it to get out of the trand save themselves. If they do not have any jet packs, they die and lose the same Ita player is able to make 30 moves without dring. They win the game. Note that a move bere includes moves forward only, not tuming rigt/left Use this template Aventure care a Notes: . Do not worry about how the cameresoods after there is a win or lose. Assame no methods will be called after a win/ess the same is over . When you print out messages use print, NOT printint Otherwise your tests may not pass during radine Examples SCPoint szap - new ArrayListo espedid new Fon(-1.0 apa.dina Pot (4) posode Pint().-21 traps.add(new Point(-3,-11) srap.add new Point(-4-1) Bistroint> jetacks - new talis achackadd neu Doint co. 1) jechackeadinou point-2,5 cesadden toist (-3) tee - Toyce (prije game,gatPlayerLocation | | | returns , ganet.getPlayerDirection>://cotans WTS game movelayer (3) Prints out "picked up jet packt gamel.galaystacation on 0,1 gamel.et layer to secure game playerunt gamalga layuncation // returneo, 1 Ont.getElayedirection) // EST gamal.novlayer (1) gamel.getPlaystation // returns -1, 1 gamt.getElayerDirection): returns HEST" garsol.playerunter samel.getPlayeztecat. Peruens - 1 gane.ge layerDirection con samallayor Bits out into a trap Biodat pokl a.tlagertocation: Watutn 1.0 atteet PlayerDirecties) // return "SOUTS" gamal.playerTurnight gatrets getEleverlesation : 44 retute -1, Q. yamel.getzlayerDirection); // returns "REST camel. Dlayer Qamet pelayettocation sets -2.0 gamal.gottayo // toturns HET novesayer gomet.etPlayer tocation : 1/ return -3.0 game gtPlay wri Gian 4 | teaETLE "HEET" Gamal.playerurtat gamel.getElayectocations // returns -3.0 gana.gablayerDirection et "TH ameloveyor Trints out all into trap! You lose je import java.awt.Point: SI sy A class for an adventure game with a player, traps, and get packs. The #world measures 30 x 1e, and the center of the world is at coordinates o, e. 20 public class AdventureGame 23 ADD YOUR INSTANCE VARIABLES HERE 13 " 15 Constructs with player location, (in the center of the world facin north, with the traps and get packs civen 17 18 astraps list of location of traps (assume all within world bounds, 19 and not a.) 20 Bare detracks list of locations of det packa (assure all within world bounds, and not at. ) * public AdventureGame(List Point> traps, List Point> JetPacks) 24 // FILL IN 25 > 16 21 26 20 Turn the player to the left . public void playerTurnleft() 1 FILL IN > 4 37 Turn the player to the right public void playerTurnright() { 1 FILL IN > 42 45 88% $ Moves the player one step in the wirection they're facing as long as the move 15 a valid one within the bounds of the world) public void movePlayer() 1/ FILL TH > 4 49 50 51 57 55 56 57 Return the player's current location return the player's current location */ public Point getPlayerLocation) return null; // FX > 59 63 4 65 56 67 Returns the direction in which the player is currently facing (NORTH,soun, "AT", OST) return the direction in which the player is currently facing public string getPlayerDirection() { return; // FIXE > 21 72 7 75 76 * Returns the number of moves the player has taken return the sumber of moves the player has " public int get ovestade() { return -1; // FIX ) 20 30 39)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

What are the components of the term performance in the HCI context?

Answered: 1 week ago

Question

Use the extremesautocrat/10 and democracy/1 with caution.

Answered: 1 week ago

Question

=+What is the purpose of this document or message?

Answered: 1 week ago

Question

=+Who is the target audience?

Answered: 1 week ago