首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
代写program编程、代做Java语言程序
项目预算:
开发周期:
发布时间:
要求地区:
Foundations of object-oriented programming
Assignment 2023 – a Wordle simulator
This is the assignment for COM6471 Foundations of Object Oriented Programming,
The aim of this assignment is to test your ability to:
●Write an object oriented program in Java that makes use of several different classes.
●Write classes from a basic specification, which is vague in some details.
Ensure that you read the entire assignment specification carefully before you begin. This is a challenging assignment, and you will need to allow some time to design your solution before you begin writing any code.
Introduction
This assignment requires you to build a Java program to simulate the popular game Wordle (see https://www.nytimes.com/games/wordle/index.html for details). In this game a 5-letter English word is chosen from a list, and the player must guess the word in six attempts or less. Following each guess, the player is told which characters in the guess are present in the chosen word, and which of these characters are in the right location. The player uses this information to deduce the chosen word.
In this assignment, you will write a Java program to simulate Wordle that will run in one of two modes:
1.Computer selects a word at random from a list that is stored in a text file, and the user has six attempts to guess the chosen word.
2.User selects a word from a list that is stored in a text file, and the computer has six attempts to guess the chosen word.
I have provided two Java classes, and your submission must use these classes, as well as others that are specified below.
Unfair means
We take the use of unfair means very seriously[]. This is an individual assignment. You must work on it alone and hand in your own code. You must not share code with other students, or submit work done by another student, or anyone else.
You must not post this assignment to any website to seek assistance, and you must not use code downloaded from anywhere except the two classes I have made available on Blackboard. All submissions will be run through specialised software that detects similarity among Java programs, as well as similarity to online resources, and action will be taken in cases where unfair means are suspected.
Task and requirements
Overview
The aim of this assignment is to write a Java program to simulate Wordle. Your code must include at least four classes:
●WordleGame.java – This class is provided for you to download from Blackboard. You must use this code, and it should not be modified in any way.
●BaseGame.java – An outline for this class is provided for you to download from Blackboard. You will need to populate the class with instance fields and methods.
●UserGuesses.java and ComputerGuesses.java – These classes should extend BaseGame.java, and each should provide a run() method that provides a concrete implementation of the abstract run() method in BaseGame.java.
Your program should compile with javac WordleGame.java, with java version 17 and should run when the user types java WordleGame. When it runs, your program will generate the following dialogue:
A new game has been created
Please select either (1) User guesses or (2) Computer guesses :
User guesses game
A game where the user guesses should then proceed as follows:
Please select either (1) User guesses or (2) Computer guesses : 1
Constructing a new game with user guesses
The computer has selected a word, and you have 6 attempts to guess it.
The computer will respond with:
+ to denote a correct character in the right location.
* to denote a correct character.
X to denote an incorrect character.
Attempt 1 of 6
Available letters : abcdefghijklmnopqrstuvwxyz Please enter a word, 5 characters long : idler
Checking -idler- is valid
Word -idler- contains a-z only
Word -idler- is valid
Your guess : idler Response : XX+*X
Attempt 2 of 6
Available letters : abc_efgh_jklmnopq_stuvwxyz
Please enter a word, 5 characters long : uncle
Checking -uncle- is valid
Word -uncle- contains a-z only Word -uncle- is valid
Your guess : uncle Response : *XX*+
Attempt 3 of 6
Available letters : ab efgh_jklm_opq_stuvwxyz
Please enter a word, 5 characters long :
And so on, until all 6 attempts have been used.
The first stage is for the computer to select a word, at random, from a list of 5-letter words that are read in from a text file. This text file must be stored in the same folder as the Java source code. You can use EasyReader to read the list.
I have provided two text files for you to use. Each file has an integer on the first line, which gives the total number of words in the file. The file called FiveLetterWords.txt contains a list of 26 words, and is intended for you to use as you develop your code. Since the number of words is small, you will be able to check that your code is working correctly.
The second file is called sgb-words.txt, and is a list of 5757 commonly used 5-letter words[ Available for download from https://www-cs-faculty.stanford.edu/~knuth/sgb.html ]. Once you believe that your code is working correctly, your code should read in the words from this file instead.
The final version your program that you submit should upload and store the words from sgb- words.txt, which must be located in the same folder as the Java code. Do not prefix the filename with a path such as C:\MyJava\Assignment.
Each time the user enters a word, your program should check that it is a 5-letter word, and that it contains only alphabetic characters and hasn’t been tried before. If the word is too long, the user should try again:
Please enter a word, 5 characters long : 24gerg
Checking -24gerg- is valid
Word -24gerg- is not the right length
Word is not valid – try again
Please enter a word, 5 characters long :
In a similar way, if the word contains any incorrect characters, the user should try again:
Please enter a word, 5 characters long : 12345
Checking -12345- is valid
Word -12345- contains incorrect characters, use a-z only
Word is not valid - try again
Please enter a word, 5 characters long :
Similarly, if the word has been tried in previous attempt, your program should be able to tell in which attempt the word has been used (3/6 attempt below means the word never has been used in the third attempt) and ask the user should try a new word:
Please enter a word, 5 characters long : never
Checking -never- is valid
Word -never- used in the 3/6 attempt, try another word
Word is not valid - try again
Please enter a word, 5 characters long :
Following each attempt, your program should compare the selected word and the guessed word, and then produce a response that is composed of the three characters ‘+’, ‘*’, and ‘X’ indicating that the corresponding letters are in the correct location, present in the word, and not present in the word respectively. Your program should also be able to tell the repetition of letter(s) in the word. For example, if the correct answer is ‘never’, a response of ‘****X’ should be obtained for the guess ‘every’. This indicates there are two ‘e’s in the correct word. If the correct answer is ‘value’, a response of ‘**XXX’ should be obtained for the guess ‘every’. This indicates only one ‘e’ in the correct word. A list of available letters should then be updated, replacing those letters that are not in the word with the underscore character ‘_’.
At the end of the game, the user should be presented with a message that either congratulates the user for solving the puzzle, or explains that the maximum number of attempts has been exceeded and gives the correct answer:
Attempt 6 of 6
Available letters : ab_d_fghijk_m_opqrstuvwxyz Please enter a word, 5 characters long : uncle
Checking -uncle- is valid
Word -uncle- contains a-z only
Word -uncle- is valid
Your guess : uncle Response : *XXXX
You have not managed to guess the word this time.
The correct answer was : fruit
Computer guesses game
If the user selects a game where the computer guesses, then the game should proceed as follows.
Please select either (1) User guesses or (2) Computer guesses : 2
Constructing a new game with Computer guesses
Select a word by choosing a number between 0 and 25 : 6
Attempt 1 of 6
Guess is : kicks
XXXXX
Attempt 2 of 6
Correct word : great, previous guess : kicks
Total number of possible words is : 8
Selecting a random word number : 5/8
Guess is : tough
*XX*X
Attempt 3 of 6
Correct word : great, previous guess : tough
Total number of possible words is : 3
Selecting a random word number : 3/3
Guess is : never
X*XX*
Attempt 4 of 6
Correct word : great, previous guess : never
Total number of possible words is : 1
Selecting a random word number : 1/1
Guess is : great
+++++
If the answer is guessed correctly within 6 attempts, the remaining attempts will be skipped. If the correct answer has not been reached, your program should continue until all 6 attempts have been used.
First, the user should choose a word by selecting a number between zero and the number of words in the word list. In this example the word is chosen from the 26 words in the text file
FiveLetterWords.txt, but your final submission should use the file sgb-words.txt so the word will be chosen from the 5757 words in this file.
The computer should then guess a random word from the complete list for the first attempt only. For each subsequent attempt, the computer should construct a new list of words that do not contain characters that are identified by ‘X’ and not identified by ‘*’ or ‘+’, in the response to the previous guess. If you have followed the previous guideline to construct a new list of words that do not contain characters identified by ‘X’ without considering the ‘*’ and ‘+’ in the response to the previous guess, you will not lose any mark. You should decide on a suitable way to store each new list of words. A word will then be selected randomly from this list in the subsequent guess.
General requirements and implementation notes
●Your submission must conform to the specification below:
oYour submission must use WordleGame.java, and you should add your own code to the template BaseGame.java.
oYour submission must also include the required classes UserGuesses.java and
ComputerGuesses.java
oYour code must operate exactly as shown in the examples above.
●Where there is no exact specification for the way the code should operate, you are free to choose a suitable approach.
●You may ask questions about these requirements, but we cannot provide help with your
assignment code, and will not check your code before submission.
●Your code must compile from the command line, and should not be assigned to a package.
●You can use any of the classes provided in the Java 17 API (https://docs.oracle.com/en/java/javase/17/docs/api/index.html)
.
●Although you are free to use more advanced Java features not covered in (e.g. the java Collections classes), it is not necessary to use them.
●You must not use any other third party Java API or code library except for this package, and the classes provided.
●Your code must read in a word list from the file sgb-words.txt, which must be stored in the same folder as the Java source code.
You should write your code using a code editor. You should compile and run your code in the Command window prompt (Windows PC) or a terminal window (Mac or Linux), which is independent from the code editor. Using an integrated development environment such as Eclipse or IntelliJ is not recommended because these tools are beyond the scope of this module. Using these tools will result in code that may not meet the general requirements listed above.
Getting started
As a first step you should write skeleton code for the UserGuesses and ComputerGuesses classes, which contains a constructor and a run() method, and uses System.out.println() to display where the focus of control is.
The next step is to consider how each of the classes in the program relates to the other classes. This is best done on a sheet of paper. You should identify what each class needs to know, and what each class needs to do in order to deliver the requirements.
You should also investigate if there are common behaviours and information that can be abstracted, and should consider if any additional classes are needed. You may decide that some variables can be defined as constants. Based on your analysis, you will be able to identify the instance fields and methods for each class.
Code each class incrementally and use a test harness – either a separate test class with a main method, or a main method embedded in the class.
Each time you make changes to the class, compile and test it. If it fails to compile, or runs incorrectly, then go back over your most recent changes and isolate the problem.
Submission and deliverables
Before you upload your code, check that it compiles on the command line using java. It is a good idea to check that it compiles and runs on one of the University computers. Check that your code is not part of a package. Do not submit archives (e.g. zip files) or .class files.
Your code should then be submitted as a java files and uploaded to Blackboard using the upload tool
Assessment
Your code will be assessed for functionality and style. A mark of zero will be awarded for programs that do not compile; it is therefore important that you check that your code compiles on a University computer with Java 17 before you submit it, in case there are any issues with the configuration of your own computer. In particular, you should check that your code and comments do not contain any Chinese characters.
Marks will be allocated as follows.
Half of the marks (20/40) will be awarded for functionality and half (20/40) for design, testing, and style. There are many different ways to code the solution to this assignment. There is no single “correct” solution, and I fully expect a range of implementations to be submitted. However, some solutions are better than others because they are more concise, and more readable.
Functionality will be assessed as follows:
●Code compiles. If your code does not compile because it is incomplete or contains an error then you will be awarded a mark of zero.
●The game is played correctly by the user : Computer selects random word from list stored in sgb-words.txt, user supplies up to 6 guesses, computer correctly identifies each character and returns the result (5 marks).
●The game is played correctly by the computer : User selects random word from list stored in sgb-words.txt, computer generates an initial random guess, and then correctly generates a reduced list of words based on comparison between the random guess and the chosen word, computer then selects a word from this reduced list (10 marks). ● User input is validated correctly at each stage (5 marks).
Design, testing and style will be assessed as follows:
●Design. Each class in the design has clear responsibilities and collaborations with other classes, has an appropriate set of methods and instance fields, suitable access modifiers are used to preserve encapsulation, and abstraction is used to enable concise coding (5 marks).
●Testing. Evidence of code used to test the behaviour of each class. This could be either a test harness for each class, or a separate test class (5 marks).
●Style. Code is written with good style (10 marks). Code written in good style will have the following characteristics:
oEach class will have a header comment, typically specifying the program name, the author, and the date.
oOther comments will only be present where necessary to enable readability.
oThe code is indented consistently throughout using four spaces and not tabs, so that the code in each method is easily identified.
oVariables and methods have meaningful names (except for loop variables, which can be a single letter, e.g. for (int j = 0; j <= max; j++) ). Variables and methods should be in camelCase (e.g. gameType).
oThere are sufficient lines of code to meet the requirements, and no extra, unreachable, or unnecessary code or comments. o See https://software.ac.uk/resources/guides/writing-readable-source-code for further details on how to write good quality readable code.
October 2023
软件开发、广告设计客服
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
软件定制开发网!