Table of Contents

Sockets and Rockets

In this fachpraktikum you will learn about socket programming and text based protocols. You will implement a bot that plays games of shootout.

Shootout

Shootout is a very simple kids game in which you try to shoot your opponent. In each round of the game, each player chooses one of three moves (reload, shoot, protect). Reloading adds a bullet to your gun. Note that you can reload multiple times in a row, each time adding a bullet to your gun. Shooting uses up one bullet if your gun contains at least one bullet at the time. The goal is to shoot your opponent when he is not protecting himself while you have at least one bullet in your gun. If both players shoot with loaded guns in the same round the game is tied. After 25 rounds in which no player is shot, the player with the more bullets in the gun wins.

There is a server running at virt14.ethz.ch and listens on port 1500. The server collects the moves of both players for each round before revealing the moves to both players. Also, the server keeps track of each player's performance (see scoring).

Exercises

  1. Connect to the server using telnet. When connected, authenticate yourself with the token given to you by the assistant and set our alias. Choose your alias wisely as it cannot be changed later in the game easily. It will be shown on the ranking website once you start playing games in easy mode.
  2. Play a few rounds of shootout manually through telnet. You will notice that games can time out. This timeout is long when playing in Debug mode.
  3. Write a bot which automatically plays games of shootout. Your client should connect to the server through a socket. Eclipse is installed on the lab computers (in /var/local/eclipse/eclipse). It can help you develop your bot in Java which includes support for socket communication. However, you are free to implement your bot in any language you would like. Be aware that we do not know all programming languages and hence cannot give you the same level of assistance in different languages. While you are working on your bot you should stay in Debug mode (i.e., you should not change modes). In this mode you should get games against a bot which answers quickly. Once you switch to Easy and Pro mode, your bot will play others. Hence it gets harder to debug since not every bot may answer in a timely manner!
  4. Once your bot can play in Debug mode, change to easy mode and see how well your bot performs against the others.
  5. To finish the Fachpraktikum, your bot should be able to play in Pro mode. This means that you should be able to handle games that occur in parallel!

Commands

Basic (Exercises 1-3):

Advanced (Exercises 4-5):

From Server:

Mount your home directory

You can use the following commands to connect to your home directory:

After which you should point eclipse to a folder below tardis-home so it is stored and accessed remotely.