Skip to main content

This is the package for the Software-Challenge Germany 2023. This Season the game will be 'Hey, danke für den Fisch' a.k.a. 'Penguins' in short.

Project description

Software-Challenge Logo

Python Client for the Software-Challenge Germany 2023

Please note that this is a very early version, which may still contain some bugs. However, the client is able to play a game from start to end.

If you have any questions about this package, you can write a issue or for faster answer write a message on our Discord server.

If you find bugs, or have suggestions for improvements, please post an issue, or contribute to the project yourself.

Thanks a lot!

This repository contains the Python package for the Software-Challenge Germany, a programming competition for students. The students have to develop an artificial intelligence that plays and competes against other opponents in an annually changing game.

This year it is the game Hey, danke für den Fisch!.

Installation

The installation is quite simple with pip.

pip install socha

If you want to install the package manually, then you have to download the release of your choice, unpack the package and then run setup.py with Python.

python setup.py install --user

This should satisfy the dependencies and you can start right away.

Getting Started

If you want to start with the Software-Challenge Python client, you have to import some dependencies first.

The import is kept very simple, since herewith all needed dependencies are imported, due to changes of the __init__.py. But if you want to avoid unnecessary imports, you can of course import only what you actually need.

from socha import *

If you now want to develop and implement your logic, then the structure of the class should look like this.

class Logic(IClientHandler):
    gameState: GameState

    def calculate_move(self) -> Move:
        possibleMoves = self.gameState.get_possible_moves()
        return possibleMoves[0]

    def on_update(self, state: GameState):
        self.gameState = state

    def on_error(self, logMessage: str):
        ...

The above example is the simplest working Logic you can build. As you can see the Logic must inherit from the IClientHandler, so that you can overwrite its methods and the api knows where to find your logic.

If you're done with your version of an working player, than you have to finish your file with this function, where you call the Starter with your desired arguments. The following starts the client with the default arguments.

if __name__ == "__main__":
    Starter(Logic())

If you want to run your logic from the console, you can of course pass start arguments.

Note that any arguments passed as startup parameters will override those in the code, including the ones you set yourself.

The following arguments are available:

  • --help Print the help message.
  • --host <host> The host to connect to. The default is 'localhost'
  • --port <port> The port of the host. The default is 13050.
  • --reservation <reservation> Reservation code for a prepared game.
  • --room <room id> Room Id the client will try to connect.
  • --keep_alive If present the client will keep running, even if the connection to the server is terminated.
  • --write_log If present the client will write a log file to the current directory.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

socha-0.9.2.tar.gz (21.0 kB view hashes)

Uploaded Source

Built Distribution

socha-0.9.2-py3-none-any.whl (22.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page