Giter VIP home page Giter VIP logo

starknet-onboarding's Introduction

Starknet Onboarding

pull requests welcome badge follow on Twitter License License

Starknet onboarding with a game

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".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.