Skip to content

Commit

Permalink
docs: auto update index.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
Falcon committed Nov 13, 2023
1 parent 134223e commit 228d0f6
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,16 @@ 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.
The following are all possible imports which are available. You won't
need every, but for the sake of completeness all are listed.

.. code:: python
from socha import *
from socha import Accelerate, AccelerationProblem, Advance, AdvanceInfo, AdvanceProblem, Board
from socha import CartesianCoordinate, CubeCoordinates, CubeDirection, Field, FieldType, GameState
from socha import Move, Passenger, Push, PushProblem, Segment, Ship, TeamEnum, TeamPoints, Turn, TurnProblem
from socha.api.networking.game_client import IClientHandler
from socha.starter import Starter
If you now want to develop and implement your logic, then the structure
of the class should look like this.
Expand All @@ -144,8 +146,7 @@ of the class should look like this.
gameState: GameState
def calculate_move(self) -> Move:
possibleMoves = self.gameState.possible_moves
return possibleMoves[0]
return Move([Advance(1)])
def on_update(self, state: GameState):
self.gameState = state
Expand All @@ -164,6 +165,12 @@ arguments.
if __name__ == "__main__":
Starter(Logic())
..
If you want a complete file as an example, you can take a look at
this
```logic.py`` <https://github.com/maxblan/socha-python-client/blob/master/logic.py>`__.

Start arguments
~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -314,7 +321,7 @@ can use a logic written in Python and make changes in the Rust code.
Each time a change is made, ``maturin develop`` must be executed again
to make the change visible to the Python code.

.. |Read the Docs| image:: https://img.shields.io/readthedocs/socha-python-client.readthedocs?label=Docs
.. |Read the Docs| image:: https://img.shields.io/readthedocs/socha-python-client?label=Docs
:target: https://socha-python-client.readthedocs.io/en/latest/
.. |PyPI| image:: https://img.shields.io/pypi/v/socha?label=PyPi
:target: https://pypi.org/project/socha/
Expand Down

0 comments on commit 228d0f6

Please sign in to comment.