Java Assignment | Design and Implementation

Added on - 18 Sep 2019

  • 9

    pages

  • 2796

    words

  • 74

    views

  • 0

    downloads

Showing pages 1 to 3 of 9 pages
Assignment #10 – Part 2Problem DescriptionYou are to complete the design and implementation of the Blox game. Noadditional files will be provided, as your work will consist of completing the project youbegan in the previous assignment.You must now implement the rules as presented below (same as before), with ademonstration of such rules provided in an extensive sample run of the program belowthat. Your implementation must contain the methods declared below and function asexpected, but you may create additional methods at your discretion to further divide thetask at hand.playGame: This method should take as parameters the map, player location, andthe number of blox in the current game. It should be called from within main instead ofprinting the map, and should contain the core logic to control the play of a single map. Ifyour main method was developed as expected, it is likely that the only required changeto that method would be to replace the printMap call with a playGame call.getMove: This method should be very similar to your getDifficulty method, exceptthat it prompts for movement within the game rather than the difficulty with which to setup a new game. While it is important that it ensure that the input was a movementaction, it does not need to determine if that movement is currently allowed.movePlayer: This method should take as parameters the map, player location,and the move just entered by the player. It should return an integer constantcorresponding to the status of the move made by the player. There are three possiblemeaningfully different outcomes from a given player move; 1) the move is blocked, 2)the move is not blocked, or 3) the move is not blocked AND pushes a block into a hole.The return value from this method should indicate which of these is the case, as theplayGame method will need this information. However, before returning that value, themethod must determine which of them is the case and update the map/player location asappropriate.Game RulesThe player is represented by a 'P'. The player can interact with the game bymoving in one of four directions; up, down, left, and right.The blox are represented by '*' and the holes by 'O'. The goal of the game is topush the blox around until each block has filled one of the available holes. Theplayer pushes blox by standing beside them and moving towards them. If the farside of the block is clear (or a hole), both the player and the block will move.If the player pushes one of the blox into a hole, both the block and the holedisappear (the block filled the hole).The map is surrounded by a border which is impassable to both the player andblox.The player wins the game once every block has been pushed into a hole.The player loses the game if they quit or walk into a hole that has not been filled.1
Marking Scheme[2 marks] Presentation/Style: Organization, readability, descriptive identifiers,meaningful constants, indentation, and bracket placement.[15 marks] Correctness: Program works without bugs. Implementation of allassigned methods. Submission implements game rules as explained above.[2 marks] Comments: Header and internal.[1 mark] Algorithm: Provide an algorithm for the movePlayer method, and anymethod called by it. You may want to write this first to assist withdeveloping your program.Bonus MarksAll of the following must be implemented efficiently in order to qualify for marks,but can be completely omitted from your submission at no penalty.[5 marks] Part 1 completed correctly and on time.[2 marks] Zoom option: Add an additional movement option to the player that scalesthe size of everything printed by the map, including the player, empty spaces,and the border.[3 marks] Scaling difficulty: Implement a numeric difficulty setting that ranges from 1upwards (decide on a large range that is useful to you). Each time the playercompletes a game increment the difficulty of the next game by 1, instead ofprompting for a new difficulty. This should actually impact gameplay in anon-trivial manner (don't just use it directly as the size and number of blox).[3 marks] Push multiple blocks: Allow the player to push multiple blox arranged inseries as long as the last block in the series has room to move.[2 marks] Creative additions: Come up with something interesting of your owndevising and be sure to document it so that your marker is aware of it. Nopromises, but maybe it will be worth some extra credit.Sample OutputThis should explain the game...Please select a difficulty - [E]ASY, [M]EDIUM, [H]ARD, or [Q]UIT: eXXXXXXXX XX O * XX P XX XXXXXXXXPlease enter a move - UP (W), DOWN (S), LEFT (A), RIGHT (D), or QUIT (Q): dXXXXXXXX XX O * XX PXX XXXXXXXXPlease enter a move - UP (W), DOWN (S), LEFT (A), RIGHT (D), or QUIT (Q): w2
XXXXXXXX XX O *PXX XX XXXXXXXXPlease enter a move - UP (W), DOWN (S), LEFT (A), RIGHT (D), or QUIT (Q): aXXXXXXXX XX O*P XX XX XXXXXXXXPlease enter a move - UP (W), DOWN (S), LEFT (A), RIGHT (D), or QUIT (Q): aXXXXXXXX XX P XX XX XXXXXXXXYou won!Please select a difficulty - [E]ASY, [M]EDIUM, [H]ARD, or [Q]UIT: mXXXXXXXXXXX XX O O XX O XX ** P* XX XXXXXXXXXXXPlease enter a move - UP (W), DOWN (S), LEFT (A), RIGHT (D), or QUIT (Q): dXXXXXXXXXXX XX O O XX O XX ** P* XX XXXXXXXXXXXPlease enter a move - UP (W), DOWN (S), LEFT (A), RIGHT (D), or QUIT (Q): sXXXXXXXXXXX XX O O XX O XX ** * XX P XXXXXXXXXXXPlease enter a move - UP (W), DOWN (S), LEFT (A), RIGHT (D), or QUIT (Q): dXXXXXXXXXXX X3