Enter the dockerized-server
directory
- build:
docker build -t dpy-last_tree .
- run:
docker run -p 8080:8080 dpy-last_tree
- use
-it
to interact with the container - the first
8080
can be changed to any host available port
- use
API is designed to respond HTTP
requests:
-
/jogador
: returns match id (-1 case game is over, and you lose) -
/tabuleiro
: return a n-uple of lists (animais
andterrenos
)- each
animal
has attributes:land
where it isfruits
number of fruits it has
- each
terreno
has attributes:seeds
number of seeds in that placeplants
number of plants in that placetrees
number of trees in that place
- each
-
/move?player=P&rule=R&animal=A&land=L
: do a series of actions- apply rule
R
on the animalA
for the landL
- animals have higher priority, if there is a land that can be inflicted by the animal's location, it will
- the land
L
is used when it's necessary to define the destination land (e.g. in a move action) - returns a tuple (
err
,msg
) whereaserr < 0
thenmsg
indicates the error, caseerr == 0
then the player won
- apply rule
-
/reiniciar?numplayers=N
: restarts a game with N players -
/ultima_jogada
: returns the last player action, with integer representing: rule, target animal and target land, respectively -
/movimentos?player=P
: returns a list of valid action (rule, animal, land) that playerP
did -
/num_movimentos
: returns the number of played action since the start of the game