https://github.com/pgdr/constellation-perseus
Mark I Colonial Viper, equipped with kinetic energy weapons and conventional missiles
https://github.com/pgdr/constellation-perseus
Last synced: about 1 year ago
JSON representation
Mark I Colonial Viper, equipped with kinetic energy weapons and conventional missiles
- Host: GitHub
- URL: https://github.com/pgdr/constellation-perseus
- Owner: pgdr
- License: agpl-3.0
- Created: 2019-04-27T13:51:45.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-05-04T09:50:31.000Z (about 7 years ago)
- Last Synced: 2025-02-01T23:42:08.689Z (over 1 year ago)
- Language: Python
- Size: 158 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# constellation-perseus [](https://travis-ci.org/pgdr/constellation-perseus)
Mark I Colonial Viper, equipped with kinetic energy weapons and conventional missiles
## Contract-driven Game development
We are using [`icontract`](https://pypi.org/project/icontract/) for
contract driven development, where we can specify **class invariants**
with `icontract.invariant`:
```python
import icontract
@icontract.invariant(lambda self: 0 <= self.damage <= 1))
@dataclass(eq=False)
class Ship(GameObject):
owner: Player
damage: float = 1.0
```
**pre-conditions** with `icontract.require`:
```python
@icontract.require(lambda obj: isinstance(obj, GameObject))
@icontract.require(lambda pos: isinstance(pos, Position))
def assign_position(self, obj: GameObject, pos: Position) -> Position:
pass
```
and **post-conditions** with `icontract.ensure`:
```python
@icontract.ensure(lambda result: isinstance(result, Position))
def add(self, obj: GameObject, pos: Position = None, ...):
...
```