Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert bot state. Bring back simulate move #844

Open
Debilski opened this issue Nov 13, 2024 · 1 comment
Open

Revert bot state. Bring back simulate move #844

Debilski opened this issue Nov 13, 2024 · 1 comment

Comments

@Debilski
Copy link
Member

We currently prepare the bot state in game.py in a scheme that mirrors the way it is later used by the Bot API.

game_state:
    team: 
        team_index: 1
        bot_positions: [[29,1],[30,2]]
        score: 0
        kills: [0,0]
        deaths: [0,0]
        bot_was_killed: [false,false]
        error_count: 0
        food: [[...]]
        name: Smart Random Players
        team_time: 0.001439541985746473
    enemy: 
        team_index: 0
        bot_positions: [[1,8],[1,13]]
        is_noisy: [true,true]
        score: 0
        kills: [0,0]
        deaths: [0,0]
        bot_was_killed: [false,false]
        error_count: 0
        food: [[...]]
        shaded_food: []
        name: Smart Eating Players
        team_time: 0.006159459124319255
    round: 2
    bot_turn: 1
    timeout_length: 3
    max_rounds: 300

There is some sense to this as it leaves out unnecessary information. For example, we do not need to send is_noisy information for our own bot.

This comes with a disadvantage, however, in that more advanced code that might want to use a different API has to revert these decisions. Specifically, code that wants to re-use the apply_move function to simulate a move has to reimplement the logic of apply_move targeted at the Bot API or write a conversion function from Bot API back to game_state (and fear that this breaks whenever new properties are added).

My proposal would be to create the Bot API on the client side and instead send a data structure similar to the game state (properly cleaned up from unnecessary/confidential data). A normal user would not see any difference when using the Bot API but a power user could still access the original game state behind a attribute.

Reference to a prior implementation of simulate_move: #399

@otizonaizit
Copy link
Member

In principle it sounds as a good idea, especially if it can be done without changing the Bot API. My guess is taht the devil will be in the details of the implementation, but it is worth a try ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants