Reference no: EM132063
Problem 1. Designing a solution to the problem and implementing the design using principles of correct syntax, layout, and program structure.
a. Design of the hangman game
b. Class diagrams of all the classes made
c. Flowcharts (logic in user authentication and listing all players)
d. All Java codes (java files and text files used for saving data)
e. Marking schedule (a template can be found on Moodle)
Problem 2. You will be asked to demonstrate your work to your lecturer in the week of the due date. There will be a range of appointment times and you can choose your time. All assignments must be demonstrated. Scenario Through a friend's birthday party, you met a team manager (Jack) of a game company in New Zealand. Through a casual chat with Jacky, you found out that he and his team are planning to make a hangman game on popular mobile platforms including iOS and Android. You were interested so you proposed to him to outsource the project to you. Since the team Jacky is leading is overloaded with many other projects, he considered and later agreed to let you have a try at it.
Thus, before making the decision to pay you for the design and programming of the complete game, the company requested to you to make a text-based version of the game first. This text-based game should demonstrate your ability to finish the rest of the project by yourself and also give them a rough idea of how the complete version might look like. Tasks The followings are the recommended steps to design and then program the game. The strategy behind is to divide the whole development into two parts.
Part A involves designing and programming a simplified hangman game which allows player to guess a single word only. Part B involves extending the game to include more interesting features such as building a small word bank for the game, saving player's game stats, authenticating player's login name and password and registering a new player. You have a choice to follow these recommended steps or do it in your own way to finish the deliverables.
Part A: Read the program scenario and some parts of the program specification (e.g. Gameplay) . Design a hangman game using structured English. Determine the variables, loops and decisions required for a single round of hangman game. A single round of hangman should involve asking player to guess a single English word through text input (keyboard) and output (screen) repetitively until he guessed every single letter of the word. Implement and validate the design in a single class with a main method. Revise the design and implementation iteratively if any mistake was made in the design.
Part B: Read the whole program specification carefully. Determine the classes required. Determine the attributes and methods required for each class. Draw class diagrams for the classes. Draw two flowcharts to visualise the program logic in authenticating player's login name and password and listing all existing players' details. Write the code for the classes. You may wish to test each of the major methods before writing the next, so that the same mistake is not repeated in multiple methods. . As you make your program, you might find a few things in your design that can be improved. Revise your design as you go.
Hint on getting your code compiled: If you cannot get some code to compile or if it causes your program to crash immediately, comment out that piece of code so that your program can be run. Program requirements Over several meetings with Jack, you and Jack worked together to finalise how the game should work and look like. You agreed to a set of requirements. These requirements are detailed over the next few pages. Please make sure your game satisfy these requirements.
When the program starts:
a. Display a welcome message. (Be creative with your welcome message)
b. Read the players text file (hangmanPlayers.txt) and store all the player records of the file into an array.
c. On the screen, display the total number of player records read from the file.
d. Display a prompt and wait for player to enter an option (Player either register or login as an existing player) Sample screen (the number of records shown is a sample only):
2. User authentication (when login as an existing player)
a. Asks player his login name and password
b. Search through the existing players to find out if there is any player with the same login and password. The authentication should be case sensitive!
c. If a record is found, the authentication is successful and the player with the matching login and password should be made as the current player. Display the current player's game stat (how many words he has guessed successfully).
d. If no matching record is found, ask player to enter his login name and password again until they match a record in the system. Sample screen (When login succeeded) Sample screen (When authentication fails)
3. User registration (when registering a new player) a. When registering a new player, prompt player to enter a new login name and a new password. The password should be entered twice to avoid any mistake from the player in the first attempt. b. If the two entered passwords do not match, repeat the process again . Sample screen
4. Gameplay
a. When a new game starts, it should display the word that is being guessed. The word should be covered by asterisks * ("little stars"). The number of asterisks should match the length of the word being guessed.
b. The program should prompt player for a String input, but only take the first character of the input. E.g. if player entered "acdc" in the input box, the program should take 'a' as the guessed character and discard the rest of the input.
c. The program should display whether the character entered has matched any of the word. Display a message according to the result and redisplay the asterisks with the characters that have been guessed successfully. (See sample screen below)
d. The game should display the characters that have been guessed so far. Sample screen (Screen after welcome and login is completed) After 5 minutes of guessing.
5. Additional features to make the game complete and more exciting to play!
1) The program should limit the number of wrong guesses allowed by player to 6 guesses per game. A game should finish after all 6 wrong guesses. It should display the number of guess left after each guess (only if the player guessed a wrong character, the program decrement the number of guesses).
2) Inform player if a character has been guessed already! Sample screen
3) After a round of game is finished, the program should prompt the player to decide whether to guess another word or exit. If player chooses to guess another word, his stat (number of words guessed) should first be updated and then store to the text file before another round of hangman starts. Otherwise, the program should save the player's stat to file and go back to the login screen. Sample screen (If player chooses to play on) Sample screen (If player chooses to finish)
4) The program should store player's details in a text file. This includes player's login name, password and how many words have been successfully guessed by player since registration. This information should be updated whenever a word has been successfully guessed.
5) The program should have a mini word bank to keep the game challenging. Build a word bank of at least 10 words. Every time an existing player plays, he should get a new word or even better if the word can be randomly selected from the bank. Some ideas: Use a string array or a text file for storing the words. Or even better, grab words from the news of the day from the Internet?
6. Advanced features
1) At registration, inform player if a login name has already been used.
2) Add some graphics to the game; you can display a hangman using ascii characters.
3) The program should always have an administrator's account in the login system by default (login name and password should both be "admin"). When an administrator logs in, he should be able to do the followings.
a) When option 1 is selected, a list of all the existing players and their details (name, password and game stat) should be displayed.
b) When option 2 is selected, the program should exit to let administrator play a game of hangman! Sample screen (Admin login and listing all users) Data validation and text file One text files is required: 1. hangmanPlayers.txt - this file is used for storing players' details. A player should have a login name, password and how many words he has guessed successfully. At the start of the program, the players file is to be read once and the contents of the file are to be stored in an array.
The file should be written every time a new player is registered or a word has been successfully guessed. All changes to player records should be done in an array first! Error Processing All input must be validated as follows: Input Valid Values Error Message Admin menu option 1,2 Error! Please select a menu option from 1-2: Login name (at registration) A unique new login name. The login name is already in use, choose another one. Answer Either "y" or "n" Error! Please enter y or n: Login and password (at login in as an existing player) Valid login and password Sorry, either your login or password is wrong!
When reading player records from file File should exist in the same directory as the program. hangmanPlayers.txt could not be opened for some reasons. WARNING It is your responsibility to ensure that the correct source file is present in the Moodle upload, with the correct filename, and that it compiles without errors in a Unitec laboratory. Failure to meet any of these requirements may mean that you lose marks for the operation of your program.
The assignment must be a product of your own work except for use of resources supplied with the course, discussions conducted by the lecturer during class time, and other assistance shown as acceptable in the section Assistance to Other Students. Marking See the marking guide on the last page for details. Your lecturer may use an oral examination to test your understanding of the material submitted. Assignments which are submitted up to one day late (Tuesday after 8:30am to Wednesday 8:30am) will be marked, but cannot achieve more than a C (pass only) grade. Assignments handed in more than 24 hours late will not be marked unless Special Assessment Circumstances apply, so it would be better to hand in an incomplete assignment on time.
Special Assessment Circumstances Students who, due to circumstances beyond their control, miss a test, exam or an assignment deadline or considering their performance in a test, exam or assignment to have been adversely affected, should complete the form available from the Student Central. Within any semester, a student may have only one SAC per course. When requesting an SAC for an assignment, the application form must be submitted (along with work completed to date) within the time frame of the extension requested i.e. if the Doctor's Certificate is for one (1) day, then the form and work completed must be submitted within one (1) day. Assistance to other Students Students themselves can be an excellent resource to assist the learning of fellow students, but there are issues that arise in assessments that relate to the type and amount of assistance given by students to other students. It is important to recognise what types of assistance are beneficial to another's learning and also what types of assistance are unacceptable in an assessment. Beneficial Assistance . Study Groups. Discussion. Sharing reading material.
Testing another student's programming work using the executable code and giving them the results of that testing. Unacceptable Assistance. Working together on one copy of the assessment and submitting it as own work.
Giving another student your work. Copying someone else's work. This includes work done by someone not on the course. . Changing or correcting another student's work. Copying from books, Internet etc. and submitting it as own work. Anything taken directly from another source must be acknowledged correctly: Specify the parts that are taken from other sources and give proper acknowledgement to the original author. For this assignment, however you are expected to do everything by yourself. Do you want to do the best that you can do on this assignment and improve your grades? You could: Talk it over with your lecturer Visit Te Tari Awhina or Maia for learning advice and support. Visit the Centre for Pacific Development and Support.