Skip to content
Snippets Groups Projects
Commit 5e22dd89 authored by David Bergström's avatar David Bergström
Browse files

Rework documentation

parent 01b52264
No related branches found
No related tags found
No related merge requests found
...@@ -14,7 +14,7 @@ Key differences: ...@@ -14,7 +14,7 @@ Key differences:
* Everything is built using cmake, allowing for one Visual studio project to * Everything is built using cmake, allowing for one Visual studio project to
build PyCommandCenter together with all its dependencies build PyCommandCenter together with all its dependencies
# Code example for making a bot: # Code example for making a bot
``` python ``` python
from library import * from library import *
......
Constants
=========
See also UNIT_TYPEID, UPGRADE_ID and ABILITY_ID for more constants.
.. _playerconstants:
Player constants Player constants
================ ----------------
The following constants are used when referring to a player: The following constants are used when referring to a player:
...@@ -10,3 +17,18 @@ The following constants are used when referring to a player: ...@@ -10,3 +17,18 @@ The following constants are used when referring to a player:
These are internally represented as integers, but these constants should be These are internally represented as integers, but these constants should be
used instead to avoid confusion. used instead to avoid confusion.
Difficulty
----------
.. autoclass:: library.Difficulty
:members:
:undoc-members:
Race
----
.. autoclass:: library.Race
:members:
:undoc-members:
IDABot
======
.. class:: library.IDABot
This is the basis of your bot. It contains all available managers and some
methods to get you started.
See :doc:`this page <quickstart>` for how to properly
inherit from IDABot.
Instances of managers:
.. attribute:: IDABot.base_location_manager
An instance of the class :class:`library.BaseLocationManager`
.. attribute:: IDABot.tech_tree
An instance of the class :class:`library.TechTree`
.. attribute:: IDABot.map_tools
An instance of the class :class:`library.MapTools`
.. attribute:: IDABot.building_placer
An instance of the class :class:`library.BuildingPlacer`
Methods:
.. method:: IDABot.get_all_units(self) -> List[library.Unit]
Retrieves a list of all visible units
.. method:: IDABot.get_my_units(self) -> List[library.Unit]
Retrieves a list of all your visible units
.. method:: IDABot.get_player_race(self) -> library.Race
Returns the players race, useful if you play Race.Random
Attributes:
.. autoattribute:: minerals
.. autoattribute:: gas
.. autoattribute:: current_supply
.. autoattribute:: max_supply
Welcome to PyCommandCenter's documentation! Welcome to PyCommandCenter's documentation!
=========================================== ===========================================
This is a Python module for implementing bots for Starcraft II. This is a Python library based on the CommandCenter bot for implementing bots for Starcraft II.
.. TODO: IDABot in toctree
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
:caption: Contents: :caption: Contents:
quickstart quickstart
types
unit
managers managers
playerconstants idabot
unit
types
constants
Short overview Short overview
============== ==============
...@@ -20,22 +23,9 @@ Short overview ...@@ -20,22 +23,9 @@ Short overview
:toctree: _autosummary :toctree: _autosummary
library library
library.ABILITY_ID
library.BUFF_ID
library.BaseLocation
library.Color
library.Coordinator library.Coordinator
library.Difficulty
library.IDABot
library.PlayerSetup
library.Point2D library.Point2D
library.Point2DI library.Point2DI
library.Race
library.TechTree
library.TypeData
library.UNIT_TYPEID
library.UPGRADE_ID
library.Unit
Indices and tables Indices and tables
================== ==================
......
Managers Managers
======== ========
The original CommandCenter bot uses managers to do everything, having managers The original `CommandCenter`_ bot uses managers to do everything, having
manage workers, building, controlling military etc. In this API we have removed managers manage workers, building, controlling military etc. In this API we
all the control related managers and only kept the managers related to helping have removed all the control related managers and only kept the managers
process input information, leaving the decision-making to the user of the API. related to helping process input information, leaving the decision-making to
the user of the API.
.. _CommandCenter: https://github.com/davechurchill/commandcenter
Here is a full list of all managers: Here is a full list of all managers:
...@@ -13,9 +16,7 @@ Here is a full list of all managers: ...@@ -13,9 +16,7 @@ Here is a full list of all managers:
* :class:`library.MapTools` * :class:`library.MapTools`
* :class:`library.BuildingPlacer` * :class:`library.BuildingPlacer`
The rest of this page contains the descriptions of each manager. The rest of this page contains a brief description of each manager.
.. TODO: How should we access the managers? Should we let the students create them themselves or should we give it to them via inhertiance
BaseLocationManager BaseLocationManager
------------------- -------------------
...@@ -80,6 +81,13 @@ MapTools ...@@ -80,6 +81,13 @@ MapTools
.. autoclass:: library.MapTools .. autoclass:: library.MapTools
:members: :members:
.. autoclass:: library.Color
:members:
:undoc-members:
.. TODO: Only include the constructor and the color constants
BuildingPlacer BuildingPlacer
-------------- --------------
......
...@@ -48,6 +48,7 @@ Now, let us break it down piece by piece to understand it. ...@@ -48,6 +48,7 @@ Now, let us break it down piece by piece to understand it.
from library import * from library import *
.. TODO: Should we really encourage this behaviour? .. TODO: Should we really encourage this behaviour?
This imports everything from the library into your namespace. This imports everything from the library into your namespace.
Next, we need to define our bot. Next, we need to define our bot.
......
...@@ -18,3 +18,25 @@ As explained above, this class is a wrapper around the class ...@@ -18,3 +18,25 @@ As explained above, this class is a wrapper around the class
.. autoclass:: library.UnitType .. autoclass:: library.UnitType
:members: :members:
:undoc-members: :undoc-members:
UNIT_TYPEID
-----------
.. autoclass:: library.UNIT_TYPEID
:members:
:undoc-members:
ABILITY_ID
----------
.. autoclass:: library.ABILITY_ID
:members:
:undoc-members:
UPGRADE_ID
----------
.. autoclass:: library.UPGRADE_ID
:members:
:undoc-members:
...@@ -37,11 +37,8 @@ Unit ...@@ -37,11 +37,8 @@ Unit
.. autoattribute:: is_valid .. autoattribute:: is_valid
.. attribute:: Unit.player .. attribute:: Unit.player
.. TODO: Add page about PLAYER_* constants
Returns the constant corresponding to player which this unit belongs to. Returns the constant corresponding to player which this unit belongs to.
See the page :doc:`playerconstants` for more information on player See :ref:`playerconstants` for more information.
constants.
.. autoattribute:: position .. autoattribute:: position
.. autoattribute:: shields .. autoattribute:: shields
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment