Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Wiki Wiki
  • Project information
    • Project information
    • Activity
    • Members
  • Packages and registries
    • Packages and registries
    • Container Registry
    • Model experiments
  • Wiki
    • Wiki
  • Activity
Collapse sidebar

Admin message

To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

  • disco
  • Public
  • Teaching
  • Fachpraktikum
  • WikiWiki
  • Wiki
  • 2 Sockets & Shotgun

2 Sockets & Shotgun · Changes

Page history
index structure readded authored Jan 30, 2019 by Roland Schmid's avatar Roland Schmid
Hide whitespace changes
Inline Side-by-side
2-Sockets-&-Shotgun.md 0 → 100644
View page @ d691cf4b
**Important**: Make sure to store everything you are working on in the
folder `local-data`. Otherwise your files will be lost in case the
computer crashes…
In this fachpraktikum you will learn about socket programming and text
based protocols. You will implement a bot that plays games of shootout.
Edit
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. Protect will save you from losing if the
opponent is shooting.
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 `virt34.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](http://virt34.ethz.ch:8000/index.html)).
Edit
1. Connect to the server using `telnet [url] [port]`. When connected,
authenticate yourself with the token given to you by the assistant
(`Auth [token]`) and set your 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. To exit
telnet, use `Strg + ]` and type `quit`
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. Make extensive use of `Help [Command]` to learn about all commands
and how they work (see also below). You have to handle incoming
server commands and send proper client commands to the server
throughout the game.
4. Implement the client which automatically plays games of shootout.
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. Your
client has to connect to server through a socket and handle incoming
messages from the server, including Authentication via the token.
While you are working on your bot you should stay in Debug mode
(i.e., you should not use the ‘ChangeMode’ command). In this mode
you will play games against a random bot which answers quickly. Once
you switch to Easy and Pro mode (using `ChangeMode [mode]`), your
bot will play others. Hence it gets harder to debug since not every
bot may answer in a timely manner!
5. Once your bot can play in Debug mode, change to easy mode and see
how well your bot performs against the others.
6. To finish the Fachpraktikum, your bot should be able to play in Pro
mode. This means that your client should be able to keep track of
games against several other teams in parallel. Each game is
identified by a unique game ID (cf. Server commands below).
Edit
Basic (Exercises 1-4):
- `Help <Command>`: Gives you more information on all the commands.
- `Auth <Token>`: You need to authenticate with your token before
playing.
- `SetAlias <Alias>`: You need to set an Alias (Nickname) before
playing.
- `DoMove <GameId> <Move>`: This is how you do a move in a running
game. You can Shoot, Reload, and Protect
Advanced (Exercises 5-6):
- `ChangeMode <Mode>`: Once you start writing your bot, switch to Easy
mode.
- `Response <Solution>`: If you change game mode, you need to respond
to the Challenge you get FAST so no human player can get into Easy
or Pro mode.
- `Stop`: If you want to stop playing gracefully. After sending Stop,
no more games will be generated for you until you reconnect to the
server.
From Server:
- `Game <GameId> <Opponent Alias>`: The server tells you that there is
a game with an id against an opponent.
- `Round <GameId> <Round Number> <Your Move> <Opponent Move> <Result>`:
The server tells you what happened in the round that just finished.
- `Challenge <a> <b>`: The server asks you to show him that you are a
bot. You need to answer the challenge fast! The Response is `a*b`.
- `Error <GameId> <Error Text>`: If something goes wrong, you get an
Error message with a little description.
Edit
You can use the following commands to connect to your home directory:
- `sudo apt install sshfs`
- `mkdir tardis-home/`
- `sshfs <yournethzlogin>@login.ee.ethz.ch: tardis-home/`
After which you should point eclipse to a folder below tardis-home so it
is stored and accessed remotely.
Clone repository
  • 1 Bash & Git
  • 2 Sockets & Shotgun
  • 3 Mario Kart Disassembly
  • 4 Web Crawling
  • 5 Parallelization in Minecraft
  • 6 Python and SQLAlchemy
  • Home