this is game project which as to be done in java (Bluej)
| ### ? | ? |
| **Programming Language** | Java |
| **Language Features etc.** | General Java previously covered in first program
Inheritance, abstract classes
# Learning Objectives Covered
The following learning objectives are either fully or partially covered by this assignment
1. Analyse and specify a programming problem.
2. Design a high-level solution to the problem using object oriented and general imperative programming language constructs.
3. Write, compile, execute, test and debug an OO program, which maps the high-level design onto concrete programming constructs, using appropriate documentation standards and software tools.
4. Critically evaluate the methodologies and conceptual tools used in developing solutions to programming problems.
5.? ? ? ? ? Critically evaluate the methodologies and conceptual tools used in developing solutions to programming problems.
# Structure of Assignment
This assignment will be set in week 9 of the semester. This is the week before the three week Easter vacation. At the time the assignment is released there will still be aspects of Java that will be needed in the work but which have not yet been covered. This means you will need to plan your work very carefully. It is suggested that you plan your work as follows:
### ·? ? ? ? ? ? ? Stage 1:
o? ? Develop the game related classes. These can be tested using BlueJ’s facilities. You may need some support classes to provide simple console based I/O but these would not need to offer any serious functionality;
### ·? ? ? ? ? ? ? Stage 2:
o? ? Develop your GUI. If you have followed a sensible strategy during stage 1 adding the GUI will not involve making changes to your game classes. The GUI material will be formally discussed in weeks 10 and 11 of the semester but material will be made available in week 9. Currently there is an introductory tutorial on GUIs on Blackboard.
# Problem Specification
Nim is a two person game in which players alternatively take “pieces?? from a pile of pieces. The number of pieces in a pile may vary from game to game. On each move a player must take at least one piece and no more than a pre-agreed limit number of pieces from the pile. In our version of the game the loser is the player who takes the last piece.
**Your task is to design and write a Java program for this game. The program must have a GUI.** ***There should be no communications via the command window****.*
# Understanding the problem
Your program will allow a user to play the computer.
The following is a brief description of the essential functional requirements for the program:
1. For each game the program will generate a random number? between 10 and 100 to determine the number of pieces? in the initial pile;
2. The program will ask the user to set a limit on the number of pieces that can be take on each move;
3. The program will ask who should go first: the user or computer;
4. On each go the user should enter the number of pieces he/she wishes to remove from the pile: this number should be validated by the program to ensure it is valid, e.g. in the range 1 to max_limit;
5. During the game a commentary of? interactions should be displayed most probably in a text area; this will indicate such things as the number of pieces left, how many the computer has taken, the final win/ loose message
6. At any point during the game the user should be able to abort the current game;
7. At any point during the game the user should be able to exit the program;
8. After aborting a game the user should be able to elect to start another game or exit the program.
For each game the program should be allowed to randomly select either a simple computer player or a smart computer player. The user must not be aware of which opponent he/she is facing. The simple computer player will make a random legal move on each turn. The smart computer player will use a strategy which is guaranteed, maybe,? to permit it to win. A suggested formula you might use for the smart computer player is:
numberPieces = (currentPileSize ??" 1) % (maxLimit +1)
For both types of computer player remember that the numberPieces must be at least 1 and may be no more than maxLimit.? You may have problems during the end game.
# Assessment Guidance
These notes are intended to indicate to you what you are expected to produce for the assessment and how you may pick up marks.
## *General points*
·? ? ? ? ? ? ? ? You must make use of inheritance in developing this program. The obvious place to demonstrate your understanding of this concept is by introducing a Computer Player class and then extending it for specific types of players.
·? ? ? ? ? ? ? ? All interactions must be via a GUI. Typically you can expect to make use of buttons, text areas, text fields.
·? ? ? ? ? ? ? ? The program should consist of a number of classes each with well defined functionality. There should be a driver class to set things going; a GUI class to provide the user interface; classes concerned with the game and the players. Remember that in object oriented programming we build programs from sets of well defined classes.
·? ? ? ? ? ? ? ? The design of the GUI is left up to you. Try to use a range of Swing features, e.g. buttons, labels, text areas, etc.
·? ? ? ? ? ? ? ? Your program should deal with error conditions by producing an error dialogue window when the use makes a mistake, e.g. attempting to take more pieces than the preset limit. (You should consider the use of JOptionPanes for the error dialogues. This will require a little investigation on your part)
·? ? ? ? ? ? ? ? All classes must be fully documented using the Javadoc.
·? ? ? ? ? ? ? ? The code you produce must adhere to the course coding standards. These standards have been published on Blackboard. Failure to adhere to the standard will lead to a loss of marks.
·? ? ? ? ? ? ? ? You will be expected to test your program against a suitable set of situations. In the documentation you should describe your testing strategy ( see below)
You must produce some design documentation. This will include a class diagram for the system, a short; explanation as to the general purpose of each of the classes you have produced and a justification for any design decisions you have made.
You must provide listings for your program. The code must adhere to the Java style standards as defined for the module. These can be found on Blackboard.
You are expected to test your code. ? During the module we looked at strategies for testing programs. You must apply these strategies to your work.
The testing section of your documentation indicates the approach you have taken to verifying and validating your system. Just as you should not convey the design of your system by presenting the code or even listing the classes, you should not merely list the tests performed. Rather, discuss how tests were selected, why they are sufficient, why a reader should believe that no important tests were omitted, and why the reader should believe that the system will really operate as desired when fielded.
1. **Strategy** An explanation of the overall strategy for testing: Black box and/or white box, integration, kinds of test beds or test drivers used, sources of test data, test suites. You might want to use different techniques (or combinations of techniques) in different parts of the program. In each case, justify your decisions.
2. **Test Data** ? A set of tables showing the test data you used for each class, etc. The format of the test documentation should be as follows:
For each test case in the tables
·? ? ? ? ? ? ? ? ? a unique id
·? ? ? ? ? ? ? ? a brief description of the purpose of the test
·? ? ? ? ? ? ? ? the pre-conditions for running the test
·? ? ? ? ? ? ? ? the test data
·? ? ? ? ? ? ? ? the expected result
You must provide a final critical evaluation of your work.
The reflection? section is where you can generalize from specific failures or successes to rules that you or others can use in future software development. What surprised you most? What do you wish you knew when you started? How could you have avoided problems that you encountered during development?
1. **Evaluation (0.5 - 1 pages).** What you regard as the successes and failures of the development: unresolved design problems, performance problems, etc. Identify which features of your design are the important ones. Point out design or implementation techniques that you are particularly proud of. Discuss what mistakes you made in your design, and the problems that they caused.
2. **Lessons (0.2 - 1 pages).** What lessons you learned from the experience: how you might do it differently a second time round, and how the faults of the design and implementation may be corrected. Describe factors that caused problems such as missed milestones or to the known bugs and limitations.
3. **Known Bugs and Limitations** In what ways does your implementation fall short of the specification? Be precise. Although you will lose points for bugs and missing features, you will receive partial credit for accurately identifying those errors, and the source of the problem.
You are expected to submit the following items:
1.? ? ? ? ? Paper Copies of
a.? ? ? ? ? ? A cover page giving your name, UN ID, and module details;
b.? ? ? ? ? A table of contents;
c.? ? ? ? ? ? Design Documentation;
d.? ? ? ? ? Test Documentation;
e.? ? ? ? ? ? The report
f.? ? ? ? ? ? Brief instructions on running your program ( this will not be marked);