vanhackathon-mastermind
API to mastermind game
MasterMind
The API was written in Django and using the package “Django-Rest-Framework” you can set the environment by creating a new virtualenv and running:
Installation
Create a virtualenv and do:
$ pip install Django
$ pip install djangorestframework
or simple run
$ pip install -r requirements.txt
Run
run by executing
$ python manage.py runserver [host]:[port]
the default host and port = localhost:8000
API URLs
POST game/{game_id}
Expect a json with the guess from the user {"solution":"12345"}. Retrieves data:
- game (the game id)
- solution (the guess)
- guess_number (1st, 2nd, ... guess on this game)
- exact (the amount of right colors and positions on the guess)
- close (the amount of right colors that are not in the right position)
GET game/{game_id}
- game (the game id)
- count_moves (moves done so far)
- max_moves (the limit of moves on this game)
- guess (a array with n guesses, this guesses display the same data as retrived in a post guess)
- state ( [new, win, playing, lose] - to let the front end know how to react )
POST /newgame
expect a json data to create and setup a new game:
- secret (the secret to be guessed)
- max_moves
Challenges I ran into
The time hehe, i ended up doing something extremely MVP
What I learned
Learned a lot new things about django rest framework. I had worked with it but the system only provided data to another service, so that was my first attempt to receive data from client and store it with this framework.

Log in or sign up for Devpost to join the conversation.