Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
CS1440
Spring 2021
Lab Guide
Jake Chanan (HTA ’20)
CS1440 Lab Installation/Setup/Handin Guide
1 Introduction
CS1440 labs consist of you, the student, coding autonomous agents to compete in various games and auctions,
against either separate autonomous agents or your classmates.
Below is a guide to installing and running the labs in CS1440. The labs are all in Java, and we highly
recommend using Eclipse. The remainder of the guide assumes that you are using Eclipse.
Each lab will contain one or both of the following components: Simulations and Competitions. In simula-
tions, your agent will execute your strategy against an offline agent implemented by the TAs. Competitions
will put your strategy to the test, pitting your agent against those of your classmates. While simulations can
be run locally, competitions are run via a central server on the CS department machines, and therefore your
lab code will need to reside there (or, at least your executable will need to be transferred to, and launched
from, there). There are two ways to accomplish this, which are detailed below.
Important: Of the two methods, FastX is definitely easier, as it requires no file transferring. However, feel
free to use either. Just know that there are more potential issues with working locally, and that the handin
process becomes much more cumbersome if you work locally. Either way, we encourage to try this before
your first lab section so that you can identify any issues early on and ask questions on Piazza.
2 FastX Guide (Recommended)
FastX is a program which allows you to work on the department machines remotely. If you use FastX, all
of your work will take place on the department machines; this means no worrying about file transfers, or
installing or downloading anything beyond FastX (as Eclipse and Maven are already installed). As such, we
recommend this setup for simplicity’s sake, though you are free to try the other method if you find FastX
annoying to use.
Below are the steps to run the labs in FastX:
1. Download, install, and launch FastX 3. Click here for CS Department instructions.
You should now have a FastX window open like so:
The following steps must all be performed within FastX.
2. Visit the course website (specifically, the Labs page) and download the lab stencil code, which will be
a ZIP file.
CS1440
Spring 2021
Lab Guide
Jake Chanan (HTA ’20)
3. Extract the contents of the ZIP file. The extracted folder should have a file called pom.xml at the
top-level. Remember the location of this file.
4. Open Eclipse by opening a terminal in FastX and entering the command:
eclipse &
If this is your first time using Eclipse, do not worry about the settings – using the default workspace is
perfectly fine.
5. Import the Lab code.
(a) In Eclipse, navigate to File → Import, and then select Maven → Existing Maven Projects.
CS1440
Spring 2021
Lab Guide
Jake Chanan (HTA ’20)
(b) Browse for the root directory, and choose the lab stencil code directory containing pom.xml.
(c) Ensure that the checkbox next to pom.xml is checked in the Projects section, and then click Finish.
This will import the lab code, along with all dependencies, into a new Eclipse project.
6. Work on the lab – fill in the stencil code as directed on the lab handout, and don’t hesitate to ask the
TAs if you have any questions! During the lab, you will come across simulations and competitions,
both of which are detailed below.
• A simulation is a locally-run version of a game or auction in which you test out a strategy
against a bot written by the TAs. When the handout indicates that a certain file is meant to be
CS1440
Spring 2021
Lab Guide
Jake Chanan (HTA ’20)
a simulation (i.e. “Fill in the code in AuctionAgent.java and run the simulation”), all you need
to do is fill in the code and use Eclipse’s Run button to launch the program from that file. You
should get a steady stream of output in the console – once the simulation ends, the program will
output a score for you and your opponent(s) so you can see how you did. Feel free to iterate on
your strategy and repeat these as many times as you want!
• A competition is a game or auction run by the TAs on a central server, in which your agent will
compete against those of your classmates. Due to anticipated difficulties brought about by our
remote setting this year, competitions will not be run live during section, but rather will be run
at the end of the week, using code you have submitted.
If the handout indicates that a file is for the competition (i.e. “Fill in the code in GameAgent.java
for the classwide competition”), just fill in the code with your strategy and follow the handin
instructions in the following steps to submit your code. You will need to name your agent (for
the leaderboard) by filling in the NAME variable.
7. Once you have finished the lab (so, you have run all simulations and written your agent for the compe-
tition), you will need to hand in your code. This is done with the handin script. All you need to do
is open a terminal, navigate to the root folder of the lab code (the folder containing pom.xml), and run
the following command:
/course/cs1440/bin/cs1440_handin 
The lab_name will be indicated on the handout.
Note that this will replace your old submissions with the newest version of your code, and the compe-
tition will be run with the latest version submitted before the start of the competition. So, feel free to
edit and resubmit your code as many times as you want.
CS1440
Spring 2021
Lab Guide
Jake Chanan (HTA ’20)
3 Working Locally Guide
If you strongly prefer to work locally and avoid using FastX, you can use this method instead, though it
requires file transferring and is generally more difficult than using FastX. As such, we only recommend using
this method if you are highly comfortable with SSH/SFTP (and if so, we still recommend practicing this
before the first lab so that it doesn’t take too much time during your section).
Below are the steps for working locally:
1. Install Maven.
• OSX Instructions
• Windows and Linux Instructions
2. Install Eclipse
3. Visit the course website (specifically, the Labs page) and download the lab stencil code, which will be
a ZIP file.
4. Extract the contents of the ZIP file. The extracted folder should have a file called pom.xml at the
top-level. Remember the location of this file.
5. Open Eclipse.
If this is your first time using Eclipse, do not worry about the settings – using the default workspace is
perfectly fine.
6. Import the Lab code.
(a) In Eclipse, navigate to File → Import, and then select Maven → Existing Maven Projects.
CS1440
Spring 2021
Lab Guide
Jake Chanan (HTA ’20)
(b) Browse for the root directory, and choose the lab stencil code directory containing pom.xml.
(c) Ensure that the checkbox next to pom.xml is checked in the Projects section, and then click Finish.
This will import the lab code, along with all dependencies.
7. Work on the lab – fill in the stencil code as directed on the lab handout, and don’t hesitate to ask the
TAs if you have any questions! During the lab, you will come across simulations and competitions,
both of which are detailed below.
• A simulation is a locally-run version of a game or auction in which you test out a strategy
against a bot written by the TAs. When the handout indicates that a certain file is meant to be
a simulation (i.e. “Fill in the code in AuctionAgent.java and run the simulation”), all you need
to do is fill in the code and use Eclipse’s Run button to launch the program from that file. You
should get a steady stream of output in the console – once the simulation ends, the program will
CS1440
Spring 2021
Lab Guide
Jake Chanan (HTA ’20)
output a score for you and your opponent(s) so you can see how you did. Feel free to iterate on
your strategy and repeat these as many times as you want!
• A competition is a game or auction run by the TAs on a central server, in which your agent will
compete against those of your classmates. Due to anticipated difficulties brought about by our
remote setting this year, competitions will not be run live during section, but rather will be run
at the end of the week, using code you have submitted.
If the handout indicates that a file is for the competition (i.e. “Fill in the code in GameAgent.java
for the classwide competition”), just fill in the code with your strategy and follow the handin
instructions in the following steps to submit your code. You will need to name your agent (for
the leaderboard) by filling in the NAME variable.
8. Once you have finished the lab (so, you have run all simulations and written your agent for the compe-
tition), you will need to hand in your code.
(a) First, you will need to transfer your files to the department machines. For your convenience, we
have written a quick Python script for this task, which you can find on the course website. If you
download it and run it with
python3 upload.py
from the project root directory, it will transfer the files for you. If you prefer a different method
of file transfer, feel free to use SFTP or any SFTP tool that you know of.
If you want to use the script but don’t have Python 3 installed, click here for instructions.
(b) Next, you will use the handin script to submit your code.
First, use SSH to access the department machines. Click here for CS Department instructions.
Once you are SSH’ed in, just navigate to the root directory of your uploaded project (in other
words, the directory containing pom.xml), and run the following command:
/course/cs1440/bin/cs1440_handin 
The lab_name will be indicated on the handout.
Note that this will replace your old submissions with the newest version of your code, and the
competition will be run with the latest version submitted before the start of the competition. So,
feel free to edit and resubmit your code as many times as you want.
CS1440
Spring 2021
Lab Guide
Jake Chanan (HTA ’20)
4 Other Tips
• Try to install Lab 1 before your section. This will save you some time, and will allow you to ask for
help if any issues arise. Be sure to post any questions to Piazza.
• Running out of space on the department machines? Try the ncdu command.
• If you are working locally and want to make file transferring more efficient, try looking into SFTP
alternatives or writing a script. If you think of a good idea, definitely share it with the class and the
TAs, so we can add it to this guide.
• Any suggestions or improvements to this guide are welcome.