首页 > > 详细

解析Java编程、Java编程辅导、辅导Java编程、Java讲解

The goal of the second part is to generate the word cloud based on the results
produced by the first part. Specifically, you are required to finish the following task:
Task 3 (Visualization): You should visualize the results of Task 2 by drawing the
word cloud on the screen. The more often words appear in the text, the bigger they
should be drawn (note that the relationship isn't necessarily linear). You should design
a placement that avoids the overlap of words (the getBounds method of our
provided TextBoard class may be helpful, see appendix). For image drawing, you
can either set up a default color scheme (for example, using the same color for all
words) or generate colors randomly. If you choose to do the latter, you should make
sure that the color contrast is good enough, and that the hue of the words that have a
similar size is also significantly different.
For Task 3, you will get a basic score if (1) the word cloud is correctly drawn, (2)
there is no overlap of words, (3) the words have appropriate font sizes. It is fine if you
only draw horizontal lines. You will get higher scores if your programs fulfill the
following advanced requirements:
 The visualization algorithm is creative and produces an image with an artistic look.
For example, you may use the overloaded write methods of TextBoard to set
different background colors or rotation angles when drawing different words.
 The word cloud can be saved to disk as a JPG or PNG file. The
java.awt.image.BufferedImage and javax.imageio.ImageIO classes
may be helpful.
 The background color of the whole word cloud image can be configured by
passing RGB color values (https://en.wikipedia.org/wiki/RGB_color_model) as
command-line arguments.

Appendix: Graphical User Interface (GUI)
As GUIs are not part of the curriculum of this course, you are provided with a
TextBoard class that writes text in different ways in a window on the screen. The
program is well-documented and you can understand the functionalities after reading
the code and comments. A test program TestTextBoard, which demonstrates the
common uses of TextBoard, is also provided to help you get started.
You may find these links helpful (PHP code isn't hard to read when you know Java):
https://24ways.org/2010/calculating-color-contrast/
https://www.splitbrain.org/blog/2008-09/18-calculating_color_contrast_with_php
In addition, you can find many websites generating word clouds on the web, try to get
inspiration from them.
 

Figure 1: How testing on the advanced Nim game solution works; the testing procedure of the task in
Section 2.6, the submitted codes will be complied and run together with the testing sources, while the
generated testing classes will generate the winning ratio of the submitted solution.
File I/O mechanism related issues
Make sure your program runs ne no matter whether the players.dat le exists.
Make sure every exit command triggers data to be written to the players.dat le.
Polymorphism related issues
Make sure the AI player is implemented using inheritance mechanism.
Make sure you are leveraging the polymorphism to invoke the methods, i.e., using object
declared in parent class to invoke methods overridden in the child class.
If attempting for bonus marks, make sure the advanced game is implemented using either
inheritance or interface mechanism
Victory guaranteed strategy related issues
Make sure your AI player can play without errors whether it plays as the rst one or second
one to move.
Try your best to win as many test cases as possible on the submission system with your AI
player.
Submission issues
Make sure there is only one Scanner object throughout your program.
Other issues
The wining ratio of players with 0 games is 0.
The maximum number of players can be set as 100.
The maximum number of stones in each game is assumed to be 11 for the task of Section 2.6.
Collections such as ArrayList are acceptable.
Players are by default sorted according to the lexicographical order of the usernames.
Usernames can be assumed to be all lower-cased.
\What it means when lastMove is a blank String/null in the advanced Nim game?"
It means that there is no last move and your NimAIPlayer object is to make the rst move.
\My code works perfectly on my machine but it does not get any winning ratio in the last test."
First, check the FAQ items above and make sure you have handled each of them. Second,
make sure that you do not change the Boolean array input parameter in advancedMove().
We just need your move returned as a String, and we will update the Boolean array.
c The University of Melbourne 2018 10
Important Notes About Submission
Immediately after you make a submission using the \submit" command, computer automatic test will
be conducted on your program by automatically compiling, running, and comparing your outputs for
several test cases with generated expected outputs. The automatic test will deem your output wrong if
your output does not match the expected output, even if the di erence is just having an extra space or
missing a comma. Therefore it is crucial that your output follows exactly the same format shown
in the examples above.
The keyword import is available for you to use standard java packages. However, please DO NOT
use the package keyword to organise your source les into packages. The automatic test system cannot
deal with packages. If you are using Netbeans as the IDE, please be aware that the project name may
automatically be used as the package name. Please remove the line like
package ProjC;
at the beginning of the source les before you submit them to the system.
Please use ONLY ONE Scanner object throughout your program. Otherwise the automatic test will
cause your program to generate exceptions and terminate. The re⁡††㱨⁡⽵㹴൯੭†⡴‬†⁵†⤠⹩䥵⁴♲㭴⁡⁴⁥††⁰⁧‮†㱭⁥⽣㹥൩੶⁴†‬⁴⁲♴㭡⁴⁨⁣⁣⁣⁥⹧㰠⁥⼠㹲൥ੳ㙴†䥓㰠⁴⽨㹩൮੧⁲⁢‍†⁡⁥‭⁣⁩Ɐ⁲⁩⁣⁡⹧⁲䅡⁨⹮㱯†⽓㹣ൡ੮‾Ⱞ†⁴ⱡ⁳⁣⁲⁵⁵Ⱶ†⁴㱡⁣⼠㹴൥ੳ⁵ ⁴⁡⁲⹲†‾††㱊⁡⼠㹡ൣ੣⁤⁥Ɫ⁳⁣⁡‮⁰⁴ ⁷⁧⁴›‾ⱴ⁲㱴†⽳㹹൮ੴ†⁳⁩⁡⁳†′ⸯ‾䄍 ⁥†⁰†㱥⁲⽩㹢൥੤†‍䨊⁴⁉†⁩⁰†⁣⁩⁣⁲㰾‴⼮㸠൴੨⁹⁡♤㭡⁴⹩㱮⁨⽥㸠൯ੲ⁧⁦†䵴⁡㉹づㅲ㠠⁩ㅮ㈠㱓⁴⽩㹯൮ਠ☲㭢㱲⼠㸾 5. (bonus) the advanced Nim game and the corresponding victory guaranteed strategy for AI players
in Section 2.6. This is a challenging task. If you cannot work out the strategy, do not get stuck on
it. Please complete all other tasks rst and leave it as the last one.
6. See LMS for a detailed marking scheme.
4 Assessment
This project is worth 10% of the total marks for the subject. Remember that there is a 50% hurdle
requirement (i.e. 20/40) for the three projects.
Please note that if you attempt the bonus task, you can get 1.5 bonus marks. The total mark for Project
C is up to 11.5. However, the total mark for the three projects cannot exceed 40. This is a challenging
task and it takes time to complete, please allocate your time wisely.
The deadline for the project is 3pm, Friday 25 May, 2018. The allowed time is more than enough
for completing the project. Late submissions will NOT be accepted.
c The University of Melbourne 2018 11
Your Java program will be assessed based on correctness of the output as well as quality of code imple-
mentation. See LMS for a detailed marking scheme.
5 Submission
The entry point of your program should be in a class called Nimsys (in a le called Nimsys.java). Thus,
your program will be invoked via:
java Nimsys
Your Java classes should be stored together in their own directory under your home directory on the
student server. Then, you can submit your work using the following command:
submit 90041 projC *.java
Note that you must submit all Java les you have used for your project, not just Nimsys.java.
If you submit you code multiple times, the later submission will overwrite the previous one. If you submit
all your java source codes and then modify one source code, you need to submit all of your source codes
again, not just the modi ed one.
You should then verify your submission using the following command. This will store the veri cation
information in the le ‘feedback.txt’, which you can then view:
verify 90041 projC > feedback.txt
You should issue the above commands from within the same directory as where your project les are
stored (to get there you may need to use the cd ‘Change Directory’ command). Note that you can submit
as many times as you like before the deadline.
How you edit, compile and run your Java program is up to you. You are free to use any editor or
development environment. However, you need to ensure that your program compiles and runs
correctly on the student servers.
The test cases used to mark your submissions will be di erent from the sample tests given. You should
test your program extensively to ensure it is correct for other input values with the same format as the
sample tests. The tests for section 2.5 are hidden.
Submit your program to the student servers a couple of days before the deadline to

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!