首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
Programming程序设计讲解、Java编程调试、Java程序辅导 讲解数据库SQL|解析R语言编程
项目预算:
开发周期:
发布时间:
要求地区:
Informatics 1: Object Oriented Programming
Assignment 1 - Connect Four
Overview
This assignment is about practising the programming concepts taught during the first few weeks of
the course. To hone and demonstrate your skills, you will complete a series of steps to implement
the board game Connect Four (https://en.wikipedia.org/wiki/Connect_Four) in Java. A basic
program structure is provided in the form of incomplete Java classes. The following three sections
describe the features you need to implement for a basic, intermediate and advanced solution. Your
submission will be accompanied by a short technical report in which you describe how your
program works and explain the reasons behind the design decisions you made.
Step 1: Creating a new project with the provided code
• Create a new project called “ConnectFour-
” in IntelliJ (or your preferred IDE).
• Download the provided code (srcAssignment1.zip) from LEARN.
• Unpack the .java files into the src folder of your project e.g.: ConnectFour-s1234567/src/
Please do not put the code into a package such as: ConnectFour-s1234567/src/main/
Step 2: Familiarise yourself with the provided code
• Study the provided code to get an idea of how the classes fit together. You will not have to
change ConnectFour.java or InputUtil.java. They are there for your convenience, but you will
need to understand how to use them.
• Pay particular attention to which class references an instance of which other class. This, together
with the comments in the provided code, will help you understand the intended flow of control.
• Start forming a plan for how to fill in the missing parts of the program. You can revise this as
you go, but having a high-level plan for how different parts fit together will lead to a cleaner
design with less restructuring and debugging required.
Marks will be awarded out of 100 and count for 20% of your overall grade for Inf1B. Each 20 credit
course is designed to involve around 200 hours of work. Of those, 10 hours have been allotted for
this assignment. Completion time may vary depending on your level of experience and the grade
you are aiming for. While you are encouraged to aim high, attempting the more difficult features is
not a requirement and grades in the upper bands are expected to be rare. Details on marking criteria
can be found in the eponymous section below.
Basic requirements
This section describes the features needed for a basic implementation of Connect Four. The
suggested sequence of steps is intended to guide you towards a solution. A decent attempt will allow
you to pass, without attempting any of the intermediate or advanced features.
Step 3: Model the state of the game
Think about how to represent the state of the board (use the default size of 6 rows and 7 columns)
and whose turn it is. Then add the appropriate fields to Model.java and initialise the variables to
represent the initial state of the game (an empty board, player 1 goes first).
Step 4: Display the board
Open TextView.java and complete the displayBoard method. Think about how you want to display
the pieces belonging to the different players and make sure the board is printed the correct way up.
You should already be able to run the program to check the output.
Step 5: Allow pieces to be played
Implement the makeMove method in Model.java. The provided code already calls this, so you
should see a piece being inserted into column number 1. Make sure the piece is inserted in the
correct position.
Step 6: Implement the game loop
Go to Controller.java and use methods provided by the view and the model to implement the flow of
the game. There is some code here that hints at how the model and view should communicate. You
will need to rearrange and add to this until the two players and take turns to play their pieces. The
model must be updated after every move and the new state of the board must be printed out.
Step 7: Game over
The game should end either when the board is full or when either of the players concedes. Think
about different ways of handling input to allow a player to give up. Detecting the winner is an
intermediate feature.
Step 8: Complete any missing features
Make sure user the user knows whose turn it is and add any missing features to tidy up the game.
Test it and make sure you catch some of the invalid inputs that can crash the game.
Step 9: Write a short report (important!)
Explain your solution and design decisions in a short report covering the following aspects:
• Give a brief, top-level description of the program’s major components and how they fit together.
• How did you represent the board and why did you choose that representation?
• How does the program keep track of which player goes next and how are players represented?
• How did you test and debug your application?
• Which problems did you encounter and how did you solve them?
• Are there any remaining issues? If so, do you have any ideas about how they could be solved?
Intermediate features
Once you are satisfied that you have all basic features working, you can enhance your program by
adding the functionality described here. This will allow you to obtain a mark of up to 69%.
Allow the user to start a new game (easy)
When the current game is over, ask the user(s) if they wish to play again. You will have to reset the
game state and wipe the board.
Variable game settings (moderate)
At the start of a new game, you can enter the desired dimensions of the board (number of rows and
columns). You should also be able to choose how many pieces you have to get in a row to win the
game, so you can play Connect X. Make sure the game can be won.
Enhanced input validation (moderate)
Now that the game settings are variable, you will have to be very careful when validating user
input. It should not be possible to crash the game or make invalid moves.
Automatic win detection (moderate-hard)
Write code to detect when the game is won and declare the winning player.
Report
State which of the intermediate features you have implemented in a separate section of your report.
Then proceed to explaining your design. Describe any difficulties you encountered (whether you
overcame them or not). If there are remaining issues, give some ideas for how they may be fixed.
Advanced features
Possible enhancements are described here. These are only required for a distinction. You may tackle
any, all or suggest your own (provided the complexity is on par with the suggested tasks). Your
report must clearly state which extensions you have attempted and briefly explain your approach
(again use a separate section). A partial solution will give you some credit. In particular, you can
gain credit by explaining any problems or limitations. Ideas for how to fix remaining issues should
also be noted even if you do not have time to implement them.
Play against the computer (variable difficulty)
Implement an NPC (non-player character) that the user can choose to play against (human vs
human must still be possible). This task can be as hard as you like. Start with a simple policy by
which the computer makes arbitrary or random (but valid!) moves. For an improved AI you could:
• Always select a winning move if there is one
• Avoid making moves that allow the opponent to win on their next turn (if possible)
• ...
Save and load the game (hard)
Implement a mechanism by which you can write the state of the game to a file. This file can be
loaded at a later stage to resume the game where you left off.
Research a design pattern
The provided code is based on a design pattern known as Model-View-Controller (MVC). Read up
on this (or another pattern) and include a short summary of it in your report. This should explain
how the pattern is used and what it is good for. The following link is a possible starting point for
your research: https://www.tutorialspoint.com/design_pattern/mvc_pattern.htm
Restrictions
To demonstrate that you can apply the concepts you were taught, your implementation is restricted
to using the basic features of the Java programming language. More specifically, the following rules
are to be observed:
• Do not use any functional language constructs such as lambdas or streams.
• Do not use any collection classes such as lists or maps.
• Do not use any third party libraries.
• Keep all classes in the default package, i.e. no package. This makes marking a lot easier.
You are permitted to use the Java API (with the exception of data structures) and indeed, it is good
practice to reuse existing code rather than reinventing the wheel. It is, however, unlikely you will
need to do so for this assignment unless you attempt advanced features.
Please note that attempting the more difficult features only removes grade capping. It does not
guarantee you a mark in the corresponding range. You still need to fulfil all requirements for the
lower categories. The quality of your code and report are also very important. Specifically, the
following criteria will be taken into account:
• Structure
◦ A good design should split the task in more manageable chunks (think divide and conquer)
e.g. by a meaningful division of the code into classes (the provided code already does this).
◦ Modularity and reusability: Classes and methods perform well defined tasks. They can be
seen as building blocks for solving many different problems, not just the task at hand. Long
methods are a symptom of a too problem-specific design.
◦ Extensibility: New features can be added without redesigning the whole program.
• Robustness
◦ The program is able to handle errors and invalid/unexpected inputs without crashing.
◦ Correct use of access level modifiers (public/private) and static to restrict exposure.
• Technical/language proficiency
◦ Use the appropriate features of your programming language. This means not restricting
yourself to building everything using a few keywords when there is a more elegant solution.
It also means not using a needlessly complex mechanism for solving a simple task.
• Readability (self-documenting code)
◦ Use descriptive but concise names for variables, methods and classes.
◦ Class names start with a capital letter, method and variable names with a lower case letter.
◦ AllNamesAreWrittenInCamelCase
◦ Exception: Static constants are written in SHOUT_CASE.
• Commenting
◦ Quantity: Comments should be used where they are useful and nowhere else. Comment as
much as you feel is needed for someone else to be able to understand your code – or to make
sure you yourself can understand it when you come back to it a year later. Do not clutter
really simple bits of code (that are self-documenting) with needless comments.
◦ Quality: Comments should provide additional insight into what is happening in the code.
They should not just re-state what the code is doing.
The basic requirements correspond to the description of a pass grade (up to 49%).
Intermediate features are required to demonstrated the mastery required for a 2nd class (up to 69%).
You will need to tackle at least one extension to get a distinction (up to 100%).
Code
As a (relative) beginner, your first priority will be to write functionally correct code. However, to
prevent bad habits from developing, you should pay attention to code quality from the very start.
The following briefly explains desirable qualities:
Documentation (i.e. your report)
Having to write a report may seem tedious, but it serves two important purposes. Documenting your
thoughts and justifying why you have chosen a particular design deepens your own understanding.
It also allows you to demonstrating knowledge and ensures that you can still get some credit for that
even if something goes wrong with your code.
Below are (some of the) qualities a good report should have. They may not all be relevant to this
assignment, but are intended to give you an idea of what is important in technical writing. Please do
not worry about your level of English. This is not a (natural) language course and as long as you can
make yourself understood, you will not lose marks.
• Content
◦ Answer questions directly without beating about the bush.
◦ Do not just write down everything you know about the topic, stick to what what was asked.
◦ Provide an insight into your decision making. Your code shows what you did, your report
should explain why you did it. For example, explain why you chose one design over another
e.g. by laying out the alternatives and their advantages/disadvantages.
• Structure
◦ Break the content down into well labelled sections.
◦ If you are making an argument, ensure you organise your points into a logical sequence.
◦ Try to make the text flow by avoiding frequent and abrupt changes of topic.
◦ Finish with an honest evaluation of your work.
• Writing style
◦ Should be clear and concise. Make the report as short as possible without cutting essential
details.
◦ Avoid repetition: Make your point once and make it well, but avoid re-stating it.
Please follow the following steps to submit your work:
1. Save your report as a PDF.
2. Put all .java files (including the provided ones) directly into a single folder called “src”.
It should have no sub-folders and use no packages.
3. Create a single .zip file containing your report and code folder.
4. For instructions on uploading the .zip file, see the Assignment 1 folder on the LEARN page.
Resubmission
You can submit more than once up until the submission deadline. Your last submission before the
deadline will be marked. Once the deadline has passed you can no longer change your submission.
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代写dts207tc、sql编程语言代做
2024-12-25
cs209a代做、java程序设计代写
2024-12-25
cs305程序代做、代写python程序...
2024-12-25
代写csc1001、代做python设计程...
2024-12-24
代写practice test preparatio...
2024-12-24
代写bre2031 – environmental...
2024-12-24
代写ece5550: applied kalman ...
2024-12-24
代做conmgnt 7049 – measurem...
2024-12-24
代写ece3700j introduction to...
2024-12-24
代做adad9311 designing the e...
2024-12-24
代做comp5618 - applied cyber...
2024-12-24
代做ece5550: applied kalman ...
2024-12-24
代做cp1402 assignment - netw...
2024-12-24
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!