FIT9131 Assignment 1

 FIT9131 Semester 2 2019 Assignment 1

With Primes
Introduction
This document specifies the programming component of Assignment 1. This component is due by
11pm Saturday of Week 7 (14
th September, 2019). Heavy penalties will apply for late submission.
This is an individual assessment task and must be your own work. You must attribute the source of
any part of your code which you have not written yourself. However, you must ensure to be able to
understand, explain, and/or modify any part of your program. Please note the section on plagiarism in
this document.
The assignment must be done using the BlueJ environment.
The Java source code for this assignment must be implemented according to the Java Coding
Standards for this unit.
Any points needing clarification may be discussed with your tutor in the lab classes.
Completion of this assignment contributes towards the following FIT9131 learning outcomes:
1. design, construct, test and document small computer programs using Java;
2. interpret and demonstrate software engineering principles of maintainability, readability, and
modularisation;
3. explain and apply the concepts of the "object-oriented" style of programming.
Specification
For this assignment you will write a program which will allow a player to play a game 21 With Primes
against the computer. This section specifies the required functionality of the program. Only a text
interface is required for this program; however, more marks will be gained for a game that is easy
to follow with clear information and error messages to the player.
The aim of 21 With Primes is for a player and the computer to compete against each other to gather
the most points while playing a single tile each turn with the goal of ensuring that the total for each
round is less than or equal to 21.
To play the game, each player (human and computer) are given a set of 5 tiles. Each tile has an value
and an associated score. For playing a tile, the player gets the associated score for that tile provided
the total is less than 21.FIT9131 Semester 2 2019 Assignment 1
Page 2 of 9
Game play
The 21 With Primes game begins with a menu displayed to the player as follows:
This menu must repeat until the user decides to exit the game by selecting the appropriate option.
Option 1:
Option 1 allows a player to register themselves before playing the game. The player is asked for their
name only. The player’s name must be between 3 and 10 characters inclusive.
Option 2:
Option 2 allows a player to play the game against the computer. Option 2 can only be selected if
Option 1 has been selected before. Option 2 will prompt the user for the number of rounds the player
wishes to play. The number of rounds playable must be greater than 0 and less than 10.
Option 3:
Option 3 will display a descriptive help menu to the user which clearly outlines the rules of the game
and how the game should be played. It should allow any user to be able to understand and use the
game without any assistance.
Option 4:
Option 4 will end the game and allow the user to exit the program.FIT9131 Semester 2 2019 Assignment 1
Game Rules
The following are the game rules:
1. Each player starts the game with zero points.
2. Prior to each round, each player is given the following set of five tiles. Each tile has a value
and an associated score:
Table 1 Points awarded for different tiles in the game
Tile Value Score
1 5
2 4
3 3
5 2
7 1
3. No other tile value can be played other than the above primes
1
. This must be validated when
the user selects a tile as well. An error message should be displayed for an incorrect selection
and the user can reselect.
4. Each player has the same set of 5 tiles. Each player can use each of their 5 files only ONCE in
each round.
5. Before each round, the game will automatically decide if the human player goes first or the
computer player goes first.
6. For each round, each player will play ONE tile, with the tile value adding to the game total
for that round. Provided the game total is less than or equal to 21, the player will get the score
for using that tile. However, if the game total is greater than 21, no score is allocated to the
player who played the last tile causing the score to become greater than 21. As per the
following example:
Round 1 both players have 5 tiles each {1, 2, 3, 5, 7}, {1, 2, 3, 5 ,7}
Human player plays tile 3. Game Total is now 3. Human player score is 3.
Computer player plays tile 1. Game Total is now 4. Computer player score is 5.
Round 2 both players have 4 tiles each {1, 2, 5, 7}, {2, 3, 5 ,7}
Human player plays tile 5. Game Total is now 9. Human player score is 5.
Computer player plays tile 7. Game Total is now 16. Computer player score is 6.
1 A prime number is a number which can only be divided by 1 and itself.FIT9131 Semester 2 2019 Assignment 1
Round 3 both players have 3 tiles each {1, 2, 7}, {2, 3, 5}
Human player plays tile 1. Game Total is now 17. Human player score is 10.
Computer player plays tile 2. Game Total is now 19. Computer player score is 10.
Round 4 both players have 2 tiles each {2, 7}, {3, 5}
Human player plays tile 2. Game Total is now 21. Human player score is 14.
Round Over
Final Score
Human Player is 14 + 5 – 0 = 19
Computer Player is 10 + 0 – 3 = 7 (Since computer player did not use the tile with value 5)
7. Once the round ends, the following are the rules for scoring:
o Each player will get their score based on the total of the tiles they have used during
the round.
o Any player who has NOT used the tile with the value of 5, will get a penalty of -3
points.
o The player who, after all deductions, has the highest score, will be the winner of that
round and will get 5 points.
8. At the end of all the rounds, the player who has won the most rounds is declared the winner of
the game.FIT9131 Semester 2 2019 Assignment 1
Game Requirements
Players must use the 5 tiles given with the associated values and scores.
Players cannot pass in any given round.
You must keep in mind that just staying under the total of 21 is not enough to win the
game.
The players MUST choose their tiles carefully in order to prevent the opponent from
getting to 21 or to deliberately end the round if they already have a higher score for that
round.
The computer player MUST demonstrate some kind of logical reasoning behind the tile
selection. The program must demonstrate some kind of simple algorithm which is used by
the computer in order to determine which tile it must play during the game.
Remember, the objective of the game is not just to reach the total of 21. Since the players
are playing together, it is a combined score. Second, the game is won by the player who
has won the most rounds. So if a player has a higher score, they may, sometimes, ‘throw’
the round by deliberately going over the total of 21 so the round ends and the other player
cannot play any more high value tiles. Keep this in mind when trying to think of how the
game should be played.
Hints and Suggestions
You are encouraged to think of how the game can be played from the computer player’s
perspective as it requires you to apply some kind of logical reasoning.
When working with multiple classes you are encouraged to understand and apply pass by
reference so as to ensure appropriate design is included within your program.
For assignment 1, you are not required to validate numeric inputs with the exception of
the menu choice. All other numeric inputs are not required to be validated.FIT9131 Semester 2 2019 Assignment 1
Program design
Your program must consist of at least four classes: Player, Game, Tile, and RNG. A suggested class
design is shown in Figure 1. There are suggested fields for each class. If you include any extra fields
then you must be able to justify these. You may want to include comments in your program to state
any assumption made.
The remainder of this section gives details of these classes.
Figure 1 Class diagram for the 21 with Primes game
Player class
The Player class will specify the attributes and behaviours of a player. An object of the Player class
will have the following fields:
name – the name of the player.
score – the score of the player for the current round
tiles – an array of tile objects which are used to play the game.
lastTilePlayed – a tile object representing the last tile which was played by the player
roundsWon – the number of rounds won by the player during the game.
The class must also have a default constructor and a non-default constructor.
The Player class should also have appropriate accessor and mutator methods for its fields. You
should not allow an object of class Player to be set to an invalid state. There should be no input from
the terminal or output to the screen. A Player object should also be able to return its state in the form
of a String.FIT9131 Semester 2 2019 Assignment 1
RNG class
An object of the RNG class will generate a random number from a minimum value to a maximum
value. It will have two fields:
maximumValue – maximum value of the random number
minimumValue – minimum value of the random number
Tile class
The tile class will store each individual tile which can be used by the player to play the game. An
object of the Tile class will have the following fields:
score - the score gained by the player from playing that tile during a round.
value - the face value of the tile which is used to calculate the round total while playing the
game.
Game class
The Game class will be in the same BlueJ project that contains your Player class. The Game class will
manage the playing of a game. It will have no fields.
The Game class will have methods to manage the playing of the game. You must demonstrate your
understanding of the software engineering principles of abstraction and modularization by ensuring
that each method does a single task only.FIT9131 Semester 2 2019 Assignment 1
Assessment
Programming Task Assessment (10%)
Assessment for this component will be done via an interview with your tutor.
The marks for your program code will be allocated as follows:
40% - Object-oriented design quality. This will be assessed on appropriate implementation of
classes, fields, constructors, methods and validation of the object’s state.
10% - Adherence to FIT9131 Java coding standards.
50% - Program functionality in accordance to the requirements.
You must submit your work by the submission deadline on the due date (a late penalty of 20% per
day, inclusive of weekends, of the possible marks will apply - up to a maximum of 100%). There will
be no extensions - so start working on it early.
Marks will be deducted for untidy/incomplete submissions, and non-conformances to the FIT9131
Java Coding Standards.
Please note that your program code will be submitted to a code similarity checker.
Interview
You will be asked to demonstrate your program at an “interview” following the submission date. At
the interview, you will be asked to explain your code/design, modify your code, and discuss your
design decisions and alternatives. Marks will not be awarded for any section of
code/design/functionality that you cannot explain satisfactorily (the marker may also delete excessive
in-code comments before you are asked to explain that code).
In other words, you will be assessed on your understanding of the code, and not on the actual code
itself.
Interview times will be arranged in the tutorial labs in Week 7. It is your responsibility to attend the
lab and arrange an interview time with your tutor. Any student who does not attend an interview
will receive a mark of 0 for the assignment.FIT9131 Semester 2 2019 Assignment 1
Submission Requirements
The assignment must be uploaded to Moodle by 11pm Saturday of Week 7 (14
th September, 2019).
The submission requirements for Assignment 1 are as follows:
A .zip file uploaded to Moodle containing the following components:
the BlueJ project you created to implement your assignment.
a completed Assignment Cover Sheet. This will be available for download from the unit’s
Moodle site before the submission deadline. You simply complete the editable sections of the
document, save it, and include it in your .zip file for submission.
The .zip file should be named with your Student ID Number. For example, if your id is 12345678,
then the file should be named 12345678_A1.zip. Do not name your zip file with any other name.
It is your responsibility to check that your ZIP file contains all the correct files, and is not corrupted,
before you submit it. If you tutor cannot open your zip file, or if it does not contain the correct files,
you will not be assessed.
Marks will be deducted for any of these requirements that are not complied with.
Warning: there will be no extensions to the due date. Any late submission will incur the 20% per day
penalty. It is strongly suggested that you submit the assignment well before the deadline, in case there
are some unexpected complications on the day (e.g. interruptions to your home internet connection).
Extensions
All requests for extensions must follow the faculty guidelines and submit the required forms as soon
as possible. In addition, when emailing for an extension, please remember to include all code
completed until that time. This assignment cannot be completed in a few days and requires students to
apply what we learn each week as we move closer to the submission date.
Plagiarism
Cheating and plagiarism are viewed as serious offences. In cases where cheating has been confirmed,
students have been severely penalised, with penalties ranging from losing all marks for an assignment,
to facing disciplinary action at the Faculty level. Monash has several policies in relation to these
offences and it is your responsibility to acquaint yourself with these.
Plagiarism (http://www.policy.monash.edu/policy-bank/academic/education/conduct/plagiarism
policy.html

热门主题

课程名

int2067/int5051 bsb151 babs2202 mis2002s phya21 18-213 cege0012 mgt253 fc021 mdia1002 math39512 math38032 mech5125 cisc102 07 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 efim20036 mn-3503 comp9414 math21112 fins5568 comp4337 bcpm000028 info6030 inft6800 bcpm0054 comp(2041|9044) 110.807 bma0092 cs365 math20212 ce335 math2010 ec3450 comm1170 cenv6141 ftec5580 ecmt1010 csci-ua.0480-003 econ12-200 ectb60h3f cs247—assignment ib3960 tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 econ7230 msinm014/msing014/msing014b math2014 math350-real eec180 stat141b econ2101 fit2004 comp643 bu1002 cm2030 mn7182sr ectb60h3s ib2d30 ohss7000 fit3175 econ20120/econ30320 acct7104 compsci 369 math226 127.241 info1110 37007 math137a mgt4701 comm1180 fc300 ectb60h3 llp120 bio99 econ7030 csse2310/csse7231 comm1190 125.330 110.309 csc3100 bu1007 comp 636 qbus3600 compx222 stat437 kit317 hw1 ag942 fit3139 115.213 ipa61006 econ214 envm7512 6010acc fit4005 fins5542 slsp5360m 119729 cs148 hld-4267-r comp4002/gam cava1001 or4023 cosc2758/cosc2938 cse140 fu010055 csci410 finc3017 comp9417 fsc60504 24309 bsys702 mgec61 cive9831m pubh5010 5bus1037 info90004 p6769 bsan3209 plana4310 caes1000 econ0060 ap/adms4540 ast101h5f plan6392 625.609.81 csmai21 fnce6012 misy262 ifb106tc csci910 502it comp603/ense600 4035 csca08 8iar101 bsd131 msci242l csci 4261 elec51020 blaw1002 ec3044 acct40115 csi2108–cryptographic 158225 7014mhr econ60822 ecn302 philo225-24a acst2001 fit9132 comp1117b ad654 comp3221 st332 cs170 econ0033 engr228-digital law-10027u fit5057 ve311 sle210 n1608 msim3101 badp2003 mth002 6012acc 072243a 3809ict amath 483 ifn556 cven4051 2024 comp9024 158.739-2024 comp 3023 ecs122a com63004 bms5021 comp1028 genc3004 phil2617
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图