everything is on that file I attachedplease keep me updated with everything and finish it as soon as possible.
assignment1pack/.DS_Store __MACOSX/assignment1pack/._.DS_Store assignment1pack/assignment1.pdf Object Oriented Programming Assignment 1 Game Development Marks available: 100 Percentage of overall marks from this assignment: 10% Date issued: 28/09/20 Deadline: 15/10/20, 17:00 Introduction For this assignment you will be creating some simple computer games. Submission instructions Submit your work by the deadline above as a zip archive1. Submit only .java source files in your archive unless told otherwise. Make absolutely sure you have are not submitting .class files instead of .java files. Where applicable, your class for each of the exercises must have the name shown in the exercise heading. Each Java file must have a package declaration at the topic of it (these declarations must be on the very first line of the file). The final part of this declaration varies according to the assignment and exercise. The package declaration for this assignment is: package com.bham.pij.assignments.rps; Do not copy and paste this package declaration from this pdf! You will get unexpected characters in your files that will render them untestable. Type it in. Your package declaration must be on the very first line of your file. Do not put anything above the package declaration, not even comments. 1If you create the zip file on MacOS, make sure it can be opened again properly before you submit it. 1 Do not forget to add the semicolon at the end of this line. All characters in a package name should be lower case. In each of these exercises, you are not restricted to only creating the required methods but you must create at least the required methods. All of the required methods must be public. None of the methods you create should be declared as static. Do not use any of the Java collections for these exercises, e.g. ArrayList. Do not use the Arrays class. Do not use the regular expressions2 in this assignment (you may pass single characters to methods that take a regular expression if you want to, but no more than a single character). Do not use non-ASCII characters anywhere in your files, even as comments. Do not output to the screen using System.out.println() unless otherwise instructed3. All strings can be treated as case insensitive unless otherwise stated. IMPORTANT: Do NOT put any code that gets user input in the required methods below. If you do, your work can’t be tested. This means that you should not use Scanner in any required method or in any method called by a required method, etc. Please ask if unsure about this. Exercise 1: RockPaperScissors [50 marks] For this exercise you can use the already-prepared Java file RockPaperScissors.java that can be down- loaded from Canvas. The file shows you, in the comments, where you need to add your code. Do not change anything else in this file. The game of ‘Rock Paper Scissors’ Rock Paper Scissors (RPS) is a simple game for two players. In the real world it is played by two people. For each turn, each person simultaneously makes the approximate shape of a rock, paper or scissors behind their back. At the count of three, both players reveal the shape they created to the other player. The winner is based on the following rules: Rock beats scissors (because scissors can’t cut a rock). Scissors beat paper (because scissors can cut paper). Paper beats rock (because you can wrap the paper around the rock). If the players create the same shape, the game is a draw. 2If you don’t know what regular expressions are, don’t worry about it. 3You can use it for your own debugging but make sure you delete those lines of code before you submit 2 The game created for you The file RockPaperScissors.java contains a game of RPS. You do not have to create the game. You will just add some code to it. The game will not work properly until you have added your code. The game works as follows. When you run the program the user is presented with a request to press the ‘r’ key to choose to play ‘rock’, or the ‘p’ key to play ‘paper’, or the ‘s’ key to play ‘scissors’. Once the player has pressed one of those keys, the game will randomly choose one of the three (rock, paper, scissors) to play as ‘the computer’. It then prints the winner of that ‘round’ to the screen and waits for the player to play again. The player presses ‘x’ to quit the game. When they do that the game prints the number of rounds won by the player and the number of rounds won by the computer to the screen. What you need to do You will add code to four methods. The methods you need to add code to are clearly identified in the file RockPaperScissors.java. The requirements for each method are stated in that source file as comments, and also presented more clearly in the HTML documentation for this class that can be downloaded from Canvas. The HTML documentation states what each method needs to do. You need to add the code to each method to make it function as required. You will learn fully about methods during this module but please bear in the mind the following so you can get started. As an example, let’s look at the following method: public boolean isValidTurn(int turn) You will see that this is the first line of that method. We call this the signature. This signature has the following parts: public: You will learn fully what this means later on. Simply put, it just means that the method is ‘available’ to be used by the rest of the program. For now we simply add that as the very first part of the signature. boolean: This is the type of the return value of the method. This means that this method must return a boolean value, which means it must return the value true or false. isValidTurn: This is the name of the method. This is the name that other parts of the program must use in order to use this method. int turn: This is the parameter that is being passed to this method. It is of type int and its name is turn. ( ): The round brackets contain the parameters of the method. In this case there is only one (called turn, as above). Look at the method signature again. This method will ‘answer a question’. The question is “is this turn (the one passed as a parameter) a valid one”. If the turn is valid it will answer that question with ‘yes’ by returning the value true. If it is not valid it will answer with ‘no’ by returning false. 3 As you will see in the HTML documentation, a valid turn has the integer value 1, 2 or 3 (one each for rock, paper and scissors). Any value that is not in the range 1 to 3 (inclusive) is, therefore, invalid. The method isValidTurn needs to check if the parameter is in the range 1 to 3. If it is it should return true, and if not it should return false. Important: All of the methods you need to create for this assignment already exist in the files. You should add your code where stated in the files. Please note, however, that in order for the files to compile without errors as they stand, return statements have been added to the methods. You will need to delete those and add your own. You will learn about these topics soon so don’t worry. In summary, therefore, you need to get the file RockPaperScissors.java and the HTML documentation. You then need to look in the file and the documentation to see which methods you need to complete. Then you need to add the code to those methods to make them work as specified in the documentation. Exercise 2: Hangman [40 marks] For this exercise you can use the already-prepared Java file Hangman.java that can be downloaded from Canvas. The file shows you, in the comments, where you need to add your code. Do not change anything else in this file. The game of ‘Hangman’ Hangman is a guessing game. In the real world, one player chooses a target word that the other player(s) must guess. This target is written down on paper (usually) as a series of underscores representing each letter. This shows the guessing player how many letters are in the word but not the word itself. The guessing player guesses announces letters they believe might be in the word. If the guess is correct, the player who set the target writes that letter on the paper in all positions in which it exists in the target word. If the letter does not exist in the target word, the player who set the target instead draws one piece of the ‘gallows’4. If the target-setting player has drawn the entire gallows before the guessing player has guessed the word correctly, the guessing player has lost the game. The game created for you The file Hangman.java contains a game of Hangman. You do not have to create the game. You will just add some code to it. The game will not work properly until you have added your code. The game works as follows. When you run the program the user is presented with a request to choose a letter, and a representation of the target word (this is the ’current guess’). When the player presses a key, the game will redraw the current guess with the new letter added, if it is in the target word. If the letter is not in the target word the game will increment the number of gallows pieces and print that value on the screen. What you need to do As for the previous exercise, you need to look at the Java file provided and the documentation and complete the required methods according to the specification in the documentation. 4There is no fixed number of gallows pieces. Every player seems to choose their own style of gallows. 4 Exercise 3: FalloutTerminal [10 marks] This exercise is quite a bit harder than the previous two. It is only worth 10% of the marks for this assignment (which is itself only worth 10% of the module marks). Attempt this exercise only when you are happy with your solutions to the first two exercises. This game is based on a ‘mini game’ from the video game series ‘Fallout’ (Bethesda Studios). You don’t need to know anything about that game to attempt this exercise, but if you google ‘Fallout terminal hacking’ and select ’images’ you will see some examples of what this mini game looks like. Also, if you are familiar with the game ‘Mastermind’ (and related), that is very similar. The game of ‘Fallout Terminal’ In this game you must ‘hack’ a terminal. You hack the terminal by guessing the password