COMP90041: Java’s Object-Oriented Paradigm - Handling of invalid Input via Exceptions - IT/Computer Science Assignment Help

Download Solution Order New Solution
Assignment Task

1 Introduction 
This project will continue the work you did on assignment 1. Please refer to the assignment 1 specifica tion for a detailed description of the game and its general rules. 
The aim of this project is to add some more advanced features to the system you previously developed. In the last assignment, you created a simple Java program to handle Nim’s core game play mechanics, including a basic command prompt environment. In this assignment, the objective is to design and implement a more sophisticated version of Nim, making full use of Java’s object-oriented paradigm. 
In addition, you will develop more advanced interactions via the command prompt. As a bonus, we added an optional challenge for those of you who would like to dive into some more advanced topics. This bonus task can be found in the supplemental material for this assignment. 
The following new features need to be added: 
• Additional commands to allow users to perform further actions on the system 
• Command prompt parameters; allowing command specific values to be provided together with the command, on the same line 
• Manage the players on the system, including the displaying of players on the system in specified sort orders 
• Handling of invalid input via Exceptions 
• Read and write the game-state variables to and from a file, persistently stored on the hard disk between executions 
• Implement a new type of player - an AI (Artificial Intelligence) player, whose moves are automat ically determined by the computer rather than a game user 
• A victory guaranteed strategy for the AI player 
• (optional) An advanced Nim game variant (for bonus marks see supplemental materials) 
The system should still operate as specified in assignment 1 but accommodate these additional features. It is advised that you use your assignment 1 solution as a starting point for further implementation. Needless to say, you will need to fix any errors that may be present in your previous project. 
This assignment will cover the following contents from lectures and tutorials: 
• Implementation of Classes and Arrays 
• Polymorphism, you may use either inheritance or interfaces to design the AI player in addition to the human player; 
• Exceptions 
• File I/O operations 
2 Requirements 
Go to https://classroom.github.com/a/3djzcZB3 and accept the assignment. For details on how to check out the repository, make sure to consult the Lab 3 Materials1. 
In this project, we introduce a third class NimGame. The game playing process is delegated from Nimsys to NimGame. Since only one game will be active at any given time, only a single NimGame instance is required at any time by Nimsys. Nimsys should also maintain a collection of players. Initially, this collection will be empty - players will need to be added in order to play a game. Your design should be able to handle up to 100 players. 
A NimGame instance needs to have the following information associated with it: • The current stone count 
• An upper bound on stone removal 
• Two players 
The system should allow for games of Nim to be played, with the rules of the game, and the players as specified by the user. 
A player, as described by the NimPlayer class, needs to have the following information associated with it: 
• A username 
• A given name (firstname) 
• A family name 
• Number of games played 
• Number of games won 
The system should allow players to be added. It should also allow for players to be deleted, or for their details to be edited. Players should not be able to directly edit their game statistics but they should be able to reset them. This system will extend the command prompt from assignment 1, which will continue until an ‘exit’ command is issued, which will naturally terminate the program. If a command produces output, it should be printed to standard output (the terminal). When Nimsys is first executed, it should display a welcome message, followed by a blank line. As before, a command prompt (a ‘dollar’ sign, i.e., $) should then be displayed. 
In the following description, all command line displays are put in a box for illustration purposes. The box should NOT be printed out by your program, only the contents in the box should be printed. The command prompt is illustrated as follows: 
figure1.JPG

At any given time, the system can be in one of two states - either a game is in progress, or no game is in progress. Hereafter, these will be referred to as the ‘game’ and ‘idle’ states, respectively. (Note: the states are just used to explain the mechanism of Nimsys. You don’t need to create a variable called ‘state’ in your code). 
When in the idle state, the system should accept the following commands: 
exit, addplayer, addaiplayer, removeplayer, editplayer, resetstats, displayplayer, rankings, startgame, start advanced game, commands, help 
More details of each command is provided in their corresponding sections below. These commands are entered at the Nimsys command prompt. If a command produces output, it should be printed immedi ately below the line where the command was issued. After the command is executed, a new command prompt should be displayed. This new command prompt should be separated from the previous com mand (and its output, if any) by a single blank line. 
Some commands are able to accept zero or more parameters. This feature is describe below. 
Note that in the syntax descriptions below, a term enclosed in square brackets indicates an optional parameter (e.g., rankings [asc—desc]. The input is assumed to be always valid, but not always correct. Valid input suggests that entered data have the same type of the corresponding variables, e.g., String data are entered for String variables, Integer data are entered for int variables. Correct input suggests that the entered data can be correctly processed by the corresponding command, e.g., adding an existing user and removing a nonexistent user are incorrect input. Unless otherwise stated, you are not required to check validity, but you need to check the correctness of the input, as shown in the below examples. 
3 Commands 
This section describes the functionality and expected output of each command your program needs to accommodate. 
3.1 help 
Help adds a basic starting prompt to assist the user. Syntax: help 
3.2 commands 
commands displays a list of all available commands, including itself. You are free to develop your own implementation of this feature. One method might be to create an object (class) of type Command. An array containing all the objects of type Command might hold each command, the commands syntax use, and a method to display itself. Note the following output characteristics: The command number 
has a space to the left, if the integer is a single digit. The required parameters, including optional parameters are displayed in line. Where no parameters are needed, this is specified. Commas separate each parameter, only. The parameters are surrounded by parentheses for illustration purposes. When the command is invoked, there are no parentheses around parameters. 
Syntax: commands 
3.3 addplayer 
Addplayer allows new players to be added to the game. If a player with the given username already exists, the system should indicate this, as shown in the example execution. Syntax: addplayer username, family name, given name 
3.4 removeplayer
Removeplayer allows players to be removed from the game. The username of the player to be removed is given as an argument to the command. If no username is given, the command should remove all players, but in this case, it should display a confirmation question first. If a username for a non-existent player is given, the system should indicate that the player does not exist. The format of these messages is illustrated in the example execution below. Handling small caps ’y’ and ’n’ is sufficient.

3.5 editplayer 
Editplayer allows player details to be edited. Note that the player’s username cannot be changed after the player is created. If a username for a non-existent player is given, the system should indicate that the player does not exist, as illustrated in the example execution. 
3.5 editplayer
Editplayer allows player details to be edited. Note that the player’s username cannot be changed after the player is created. If a username for a non-existent player is given, the system should indicate that the player does not exist, as illustrated in the example execution.

 

This COMP90041: IT/Computer Science Assignment has been solved by our IT/Computer Science Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.