Player Overview
Distribution
You should have received the Starting Player as a Tar/GZip file.
It should include all the source, shell scripts and other files
needed to get you started. You can add the project to your
workspace using the Eclipse menu:
File >> Import
Choose Existing Projects into Workspace under
the General drop-down. Select the Select Archive
File at the top, and browse to the location of the Tar/GZip
file. If you are on a CCIS Linux machine you can simply use the
full path location:
/home/lieber/.www/courses/cs4500/f09/files/source/Player/player.tgz
The Player project should be checked, and you can
click Finish. The Player project should then appear in
your Package Explorer.
Once the project is imported (and Eclipse compiles it), you can
build a runnable JAR using the makeSubmission.sh
script. You will use your team name for submissions, so I'll
use "BryansTeam" for demonstration. Open a terminal and
navigate to your Eclipse
workspace directory.
Run the makeSubmission.sh command:
./makeSubmission.sh "BryansTeam"
Which will create two JAR archives: BryansTeam.jar, which
is a runnable JAR, and BryansTeam_source.jar which contains
just your Players source. The source will be submitted to
Blackboard, and the runnable
JAR will be placed in a common scratch directory, so that all the
teams can have a number of players to test with.
The runnable JAR can be run using the command:
java -jar BryansTeam.jar
Or alternatively with:
java -cp BryansTeam.jar player.PlayerMain
If you get non-error feedback, then everything is set and you're ready
to begin exploring the source and adding intelligence. If you get errors,
then you must contact the course staff immediately.
Files and Organization
The directories are organized as follows:
Player/
overview.html
teamreadme.sh
makeTar.sh
makeSubmission.sh
scglibs.jar
files/
context.txt
test/
LocalGameTest.java
PlayerTest.java
player/
PlayerMain.java
Register.java
Player.java
player.mf
PlayerServer.java
tasks/
SolveTask.java
ReofferTask.java
AcceptTask.java
OfferTask.java
ProvideTask.java
- Player/: Base directory, contains all the sources.
Feel free to rename this for your player, but be careful running some of these
scripts.
- overview.html: This File...
- teamreadme.txt: The README file your team should
fill in for each project submission. It should include your SCRUM info, and
a development diary that describes the contribution of each team member.
- makeTar.sh: Script used to make the Tar/GZip
distribution.
- makeSubmission.sh: Script used to make the two
JARs you will submit for each project (runnable, and source).
- scglibs.jar: A JAR containing all the necessary
class files that you shouldn't have to worry about. It includes the DemeterF
Runtime and the SCGLibs source.
- test/: We've put a few test files in here to get
you started. For the sake of organization you should put all Test related Java
files in this package.
- test/PlayerTest.java: A simple Test class for the
Player.
- test/LocalGameTest.java: Runs a simple game between
a few of your Players in a single Java/Runtime instance. You can debug the game in
Eclipse this way if you notice problems that you can't figure out when running in
distributed competitions.
- files/: Use this to put any test (non-java) files or
other configuration files for your player. Currently there's
only one file, used to test the Player with a simple
context.
- files/context.txt: Contains a simple PlayerContext to test
the Player classes. See PlayerTest.java for how we use
it.
- player/: The player package, for all things
Player related.
- player/PlayerMain.java: The Main class for running the
Player; everything starts here.
- player/Register.java: Competitions
require registration with the Administrator. This class handles
that, and can be used/run to register a Player separately for
testing or multiple competitions.
- player/Player.java: Delegation point for
the Player tasks. Created with a PlayerContext and
a Logger. When play() is called it in-turn
calls each of the player tasks, to create a final
PlayerTrans.
- player/player.mf: A JAR manifest file for
the Player. This is included in the JAR to make it runnable, so that
your submitted JAR can be run with: java -jar YourTeam.jar
- player/PlayerServer.java: The HTTP server
portion of the Player. This class handles the setup/binding of
the server, and interaction with the Administrator over
sockets.
- tasks/: Package that contains the
Player's tasks/functions.
- tasks/SolveTask.java: A
basic Solution task. Basically creates a random
assignment for the variables of the given Problem.
- tasks/ReofferTask.java: Reoffers all
the Challenges from others. This is used when the
Player doesn't find challenges worth accepting.
- tasks/AcceptTask.java: Figure out what
challenges to accept. This is currently done randomly, but you
should add more intelligence.
- tasks/OfferTask.java: Creates new
challenges to be offered. Currently random, but you should
offer challenges based on more information.
- tasks/ProvideTask.java:
Provides Problems (once accepted) for others to
solve.
More Information
The source files themselves contain lots of comments and, of
course, the code that makes things work. Read through them to
see what we were thinking when the classes were
organized/written. We will also provide a document on testing
your Player with an Administrator instance both on your own, and
with others... look for that in the course directories.