Environment setup
Prerequisites
Installation
protostar install
python -m venv env
source env/bin/activate
pip install -r requirements.txt
nile install
How to use this repo
Tutorial
This repo has 2 difficulty levels: beginner, advanced, and then a final exercise.
contracts<beginner/advanced>/ex
contrains exercises with instructions on what to do.
Run pytest tests/test_<beginner/advanced>_ex00.py
and pytest tests/test_<beginner/advanced>_ex00.py
and code until the tests pass.
Repeat for all contracts. Have fun !
Final execise
Deploy
First, start a local node:
nile node
Then, deploy the contracts:
nile run scripts/deploy.py
Keep the addresses of the contracts, you'll need them later.
Goal
Implement your ship to catch as much dust as possible.
Get started
To add your ship, compile it and deploy it
nile compile
nile deploy <my-ship-contract>
Then, add the ship to the game's space
nile invoke <space-contract-address> add_ship <x> <y> <ship-contract-address>
Finally, call next_turn
to let the game computes the next turn
nile invoke <space-contract-address> next_turn
Testing
make test
Coding your ship logic can be tricky, we suggest you use tests to check your code.
You can get inspiration from the static ship tests and run this specific test with pytest tests -k "test_next_turn_with_ship"
.