SanjinDedic / agent_games

Secure, extensible agent competition platform API build with FastAPI, SQLmodel, Pydantic and Docker
9 stars 2 forks source link

Dynamic instructions and code sample #44

Closed DawoodLaiq closed 4 months ago

DawoodLaiq commented 4 months ago

Need an endpoint where I send in the league name and game name. In response I need the json for the starter game instructions and the code sample in json.

Here is an example for the code sample

'from games.greedy_pig.player import Player\n\nclass CustomPlayer(Player):\n\tdef make_decision(self, game_state):\n\t\tif game_state["unbanked_money"][self.name] > 5:\n\t\t\treturn 'bank'\n\t\treturn 'continue'\n'

First four lines are always not editable by default on the front end.

For instructions. Right now I have this

Competition Instructions

  1. Login Process

    Click on the Game Submission option in the navbar to log in.

Need an identifier for listed items, headings and bold texts.

SanjinDedic commented 4 months ago

You need to clarify the issue.

I am assuming that this is what you want:

endpoint

@app.get("/get_game_instructions", response_model=ResponseModel)
def get_game_instructions(session: Session = Depends(get_db), game_type='greedy_pig'):

Example return value:

{
  "starter_code": "from games.greedy_pig.player import Player\n\nclass CustomPlayer(Player):\n\tdef make_decision(self, game_state):\n\t\tif game_state['unbanked_money'][self.name] > 5:\n\t\t\treturn 'bank'\n\t\treturn 'continue'\n' ", 
  "game_instructions": "These are the instructions"
}

If so can you update the description and provide formatted strings for both starter code and the instructions so that they will display correctly on the website.

The strings should ideally also be readable (multi line) in the code, having a single line is a last resort.

SanjinDedic commented 4 months ago

Please test out the new branch and review the pull request. Comment below with the updated strings if appropriate

DawoodLaiq commented 4 months ago

Tested the branch and It was successful. Will explain the issues clearly and easily in the future.