Introduction to AI


Project 0: Setting up Space Settlers

Executive Summary

This assignment will take approximately one hour to complete (potentially a bit more if you are less familiar with unix systems and less if you are familiar with them).  Note that this project has two deadlines, one per part. Although this project is only worth a few points, it is absolutely required for testing the ladder. 

Note:  Although ALL future spacesettlers projects will allow you to work in pairs, this project MUST be completed by each person.  It is fine if you are already working together in pairs and help each other complete the project but you must each turn in an individual project.

By the end of this project, you will have accomplished the following objectives.

  • Part 1:
    • Have an account on the AWS spacesettlers machine
  • Part 2:
    • Have a valid copy of the source code checked out to your machine
    • Create a valid (random is fine) agent that runs in the game successfully
    • Submit your agent to the competition ladder

Class wide ladders

Each of the projects (except this project) will have two class-wide sets of agents running against or with each other. These will generally start within a few days after the project is handed out. These will be explained in Project 1 but the idea is that one set of agents will be choosing the peaceful approach and one set the more war-like approach. For this project, the only goal is to ensure that you turned in an agent successfully and that it runs without crashing. Random is FINE. There will be NO extra credit for the ladder so performance does not matter so long as your agent does not crash.  There will be only one ladder running for this project so that you can ensure your agent ran properly but you do not need to choose competitive versus cooperative.

Part 1 Videos

Every project has one or more videos to help out!  This project has several.  Watch the part 1 video for an introduction to the project and to part 1 of the project.

  • Introduction to the project
  • How to make an ssh key on mac
  • How to make an ssh key on windows

part 1: Due11:59pm Friday Aug 26, 2022 

AWS servers require the use of ssh to access them. Password access is disabled. You must instead use encrypted ssh keys. ssh is installed by default on linux and mac. If you have windows, you will should use powershell or another smart terminal app.

If you are an active ssh user and already have a .ssh/id_rsa.pub key in your home directory, skip the generation instruction below (step 1) and only follow steps 2-4.

  1. Generate a public/private key pair on your machine. This should be on the machine that you intend to use to turn in projects. Use ssh-keygen. Note that it is ok to use an empty passphrase if you trust the security of your local machine. In windows powershell, you can type ssh-keygen just as in unix.
  2. Upload your public (NOT PRIVATE) key .ssh/id_rsa.pub to canvas on Project 0: Part 1. Do not upload the private key or you will compromise your key pair. If you upload the private key, we will will NOT make your account and will require you to re-create your keys. Make sure you either upload as the raw .pub (NOT PUBLISHER) file or .txt.
  3. Note: After you have access to the machine, you can add other machines (such as a home desktop or other laptop) to the your access list. This is done by appending the contents of other id_rsa.pub files to the .ssh/authorized_keys file on your account on the spacesettlers machine.
  4. After we have confirmed your account, login to the server using ssh (directions below). This will allow you to list/view/edit files within your home directory (and list/view files in some other directories). It will also be what you use to turn in your projects all semester! Your username is your 4×4.

 

part 2: Due 11:59pm Wednesday Aug 31, 2022

Part 2 focuses on getting spacesettlers up and running on your machine and ensuring you can turn in code on the AWS machine.  As with Part 1, we have both text and video tutorials available.

  1. Download and install an Integrated Development Environment (IDE).
    • You MUST use an IDE for these projects! You can pick your favorite IDE but the instructions below are for eclipse, which is a very good IDE available for free for any platform.
  2. Download and install the Space Settlers code.
    • The code is stored in a github repository. It is good for your future jobs to know how to use existing code bases and how to work with a repository. Your next step is to download the latest code from the github repository (URL below). The advantage of the online repository is that you will have access to bug fixes. For all projects, both finding and fixing bugs will get you extra credit. You can submit your bug reports using github or through the class slack (more in future projects).
    • If you have never used git before, please look up tutorials online. git support is incorporated into eclipse so you should be able to clone the repository directly from eclipse. The main commands you will need to know are: clone and pull. You will NOT be checking any changes directly into the code base this semester so you do not need to worry about push or commit.
    • Note: if you fork the repository into your own GitHub account, ensure the fork is private. You can make private repositories with an academic email account for free with GitHub.  If you make a public fork, anyone else in class can see your code. This can be used for academic misconduct and thus we will give you a zero for any non-private forks we can see (see rubric below)
  3. You can test your download of the code in either of two ways.
    1. You can go to the directory where you downloaded the code and type:
      • ant spacesettlers-human
      • Note that this method of compilation requires the “ant” program
    2. You can also run it from eclipse by right clicking on the build.xml file in eclipse and choosing the second ‘run as ant build’ option. Then choose ‘spacesettlers-human‘.
      • Note: if neither method works, you have either not properly downloaded the code or you need ant or java installed properly.
  4. The next two steps below (#5 and 6) are discussed in this video
  5. Create a controllable agent (e.g. something that controls an agent) that makes legal moves. For this project, it is perfectly acceptable to reuse the sample random agent. The point of this project is to ensure you can get the mechanics of your player working, not that you have made the world’s smartest player. Note that although the ladder will run once for this project, it will NOT count for extra credit. You can find the sample random agent at:
    • spacesettlers.clients.RandomTeamClient
      • Your agent needs to run in its own package. This package MUST be your 4×4. If you copy the random agent, be sure to change the package header to be:
      • package your4x4;
    • All of your code must run in a single package based on your OU 4×4 id. To compile and run your code with the spacesettlers code create a directory under spacesettlers/src with your 4×4 such as spacesettlers/src/your4x4. Place your java source files in this directory.
  6. To make the simulation know about your new agent, you also need an initialization and configuration file. There is a sample init file in the config/human subdirectory. You should copy random-clientinit.xml and point it to your own agent. Name the file spacesettlersinit.xml. Then you need to change SpaceSettlersConfig.xml to point to your new agent and config file. Make sure you change the ladderName setting to something with your name in it so that I can give you full credit. The ladder name can be funny but it must follow two rules:
    • It must be G-rated and contain nothing offensive or derogatory
    • It must contain your name somehow so that we can properly give you a grade (e.g. Team Winner doesn’t tell me who you are unless your name happens to be Winner!)
  7. The next step below (how to submit) is discussed in this video
  8. Submit your project on the AWS server using the submit script as described below. Note this server is NOT a webserver. You must login as described below.
    1. ssh into spacesettlers.cs.ou.edu using the account that was created for you for this class. Your username is your 4×4. This should be a passwordless login because it relies on your ssh keys. If you did not create your account in part 0, contact Matt immediately. He cannot create accounts at the last minute and you will not get credit for the assignment if you do not check this ASAP.
      • To login to the server, either use ssh at a terminal window (mac or linux) or use an ssh client such as putty (windows)
      • The address is spacesettlers.cs.ou.edu. Your username is your 4×4.
    2. Make sure your working directory contains all the files you want to turn in. For example, my directory contained the following files:
      • AmysRandomAgent.java spacesettlersinit.xml
    3. You must copy the files from your laptop or desktop to the spacewar machine. To do this, you can use the scp command (mac, linux) or the pscp or winscp program (windows). Make sure you copy the files to a directory that does not allow everyone else to read your files!
    4. Submit your file using the following command (be sure your java files come last):
      • /home/spacewar/bin/submit --config_file spacesettlersinit.xml --project project0 --java_files YourJavaFiles.java
    5. After the project deadline, the above command will not accept submissions. If you want to turn in your project late, use:
      /home/spacewar/bin/submit --config_file spacesettlersinit.xml --project project0_late --java_files YourJavaFiles.java

We will run a sample ladder after 12:01AM on Sep 1. This ladder will not count for extra-credit points as the focus of this part of the assignment is to make sure that your accounts are setup correctly and that the ladder is able to run each of your players. If you do not see your agent in the final ladder that we post on #annoucements, you will want to fix it before Project 1!

Note, your grade for this part of the project will show up on canvas in Project 0: Part 2 but you will NOT turn your files in there.  You must turn them in as described above!

rubric

Since the point of this assignment is to ensure that your accounts are setup correctly and that your program runs without crashing, the rubric is pretty simple. It is split into the two project components.

  • Part 1: Creating an account
    • points for creating your account correctly by following the directions in part 1
    • 0 points if you did not create an account
  • Part 2: Turning in code
    • 5 points for an agent that correctly runs in the ladder and has a unique team name with the name of the person in the team (it can be made punny, it can be not your full name, it just needs to be enough of your name that I can easily give points in the ladder)
    • 0 points for the agent not running correctly
  • Using GitHub
    • 5 points if you correctly copied (either cloned or forked) the code into a repository that is private! This means NOT public.
    • 0 points if you created a public copy of the code that we can see on GitHub