Commit b2e7dea6 authored by Marcus M. Scheunemann's avatar Marcus M. Scheunemann

Describe installation with virtual environment module (venv) and use a...

Describe installation with virtual environment module (venv) and use a `requirements.txt`. Describe contribution guidlines and link to the wiki (move docs there), add a license
parent 0058de0f
MIT License
Copyright (c) 2018 Bold Hearts
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\ No newline at end of file
# Python Cup
This is based on Daniel Polani PythoCup
This is based on Daniel Polani's [PythoCup](https://gitlab.com/boldhearts/pythocup-fltk).
PythoCup is a python-based simple simulator to study several aspects of the 2D RoboCup scenario without the hassle of understanding the detailed synchronization and command model of the standard 2D simulator. It simplifies many aspects, does not include turns, currently does not implement noise, outs (field boundaries) and many other features, and has been developed on-the-fly for the purpose of an quick-access to 2D RoboCup scenarios.
## Prerequirements
- Python 3
- Python 3 (installation [described below](#python-version-3))
- Pygame 1.9.3
## Install
You'll need python 3.5.3 or later. You can find out your python version with the command `python --version` or `python3 --version`.
### Clone this code
Create a folder named, e.g., `PythoCup` and clone the code:
git clone git@gitlab.com:boldhearts/pythocup.git
### Create a virtual environment
Python's [virtual environments](https://docs.python.org/3/library/venv.html) come in handy for encapsulating dependencies from global installed packages. The following command uses the `venv` module and creates a folder named `pyenv-pythocup` with the environment:
python3 -m venv pyenv-pythocup
You will need to source the environment in the terminal you're working in:
source pyenv-pycup/bin/activate
If successful, the prompt of the terminal will have a prefix with the given name of the virtual environment (i.e. pyenv-pythocup). You can now install all requirments with the following command:
pip3 install -r requirements.txt
Test if Pygame is working with running:
python3 -m pygame.examples.aliens
## Python version 3
If your system doesn't have Python's version 3, you can install it the following way:
### Ubuntu/Linux
Install
1. Open the `Terminal`
On older systems, you may have to install python version 3 like this:
```
sudo apt-get install python3 python3-pip
pip3 install pygame
......@@ -40,8 +71,8 @@ pip3 install pygame
1. Check the python version `python3 --version`
2. `python3 -m pip install pygame`
## Test
Open the `Command Prompt` or `Terminal`
```
python3 -m pygame.example.aliens
```
# Further Information
You can read about used [classes](https://gitlab.com/scheunemann/pythocup/wikis/Useful-Classes) in the wiki. There is also a set of [exercises](https://gitlab.com/scheunemann/pythocup/wikis/Exercises) to begin with.
# Contribution
You're welcome to contribute. Please have a look at [Gitlab's workflow](https://docs.gitlab.com/ee/workflow/forking_workflow.html) first. It is helpful if each commit addresses a specific feature before requesting a merge. You can achieve this with, e.g., squashing the commits of your working copy.
\ No newline at end of file
# Exercise
## Preliminaries
git clone the repository
## Tasks
1. Run `sample.py`
2. Write an agent that stays on the spot.
3. Write an agent that moves towards the ball.
4. Write an agent that moves towards the ball and kicks it towards the opponent goal.
5. Do the same thing for an agent that is on the wrong side of the ball; i.e. include a trip around the ball.
6. Create an agent that tries to put itself between the agent from above and its own goal, to block the kicks
## Advanced Task
Try to write an agent that supports the attacker (or the defender) of the last exercise.
# Useful Classes
## Team (Class)
To setup a team you have to give it a Side
> Team(Side)
#### put()
Puts a Brain on the team and sets it field location
> put(Brain, (100, 250)) -> None
## Side (Enum)
- LEFT
- RIGHT
#### other()
Returns the opposite side
> other() -> Side
## ObjectType (Enum)
- BALL
- GOAL
- PLAYER
## CupObject (Class)
- type -> ObjectType
- pos -> Vector2
- side -> Side OR None
## Brain (Class)
- pos -> Vector2
- side -> Side
- can_kick -> Boolean
- ball -> CupObject
- self_goal -> CupObject
- other_goal -> CupObject
- self_team -> [CupObject, ...]
- other_team -> [CupObject, ...]
#### sorted_object()
Returns a sorted list of all CupObject by distance
> sorted_object() -> [CupObject, ...]
#### action()
This needed to be defined in your inherited class
> action() -> Vector2 , Vector2
## pythocup
#### run()
When given a Left and Right Team it will run the simulation
> run(Team(LEFT), Team(RIGHT)) -> None
## Vector2 (Class)
docs: https://www.pygame.org/docs/ref/math.html#pygame.math.Vector2
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment