Open meatballs opened 7 years ago
I don't think we need anything adding to the library itself. Instead, I reckon we could use a django model (and db storage) to hold the details of tournaments which have been created and run.
I have a prototype that accepts post data and processes a Tournament/Match - right now it is just synchronous with no storage to try and make sure the endpoint is ok.
Right now you would:
verb: POST url: /tournaments/ data:
{
"name": "tournament",
"turns": 150,
"repetitions": 5,
"noise": 0.1,
"with_morality": false,
"player_list": ["adaptive", "allcoralld", "adaptive", "anticycler"]
}
It returns a JSON response with all the fields in a ResultSet
axelrod object.
For GET I think a similar list of class inspection as the
StrategySerializer
uses would work. As of now this would provide id, name and description.For
params
a similarinit_param
that exists on thePlayer
class could be added to theTournament
,MoranProcess
, andMatch
.Additionally I think a
min_players
andmax_players
attribute on these classes would be helpful in a UI to guiding the user what is necessary to start a tournament. It could be useful for the python implementation too. For example passing one strategy to aMatch
results in an index error, passing three results in the first two being used and the third being ignored. Explicitly stating the min and max amount of players could let a more descriptive error be thrown, i.e.