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

Guesstimation of total pawns by id() #134

Open
cooljoseph1 opened this issue Apr 24, 2020 · 4 comments
Open

Guesstimation of total pawns by id() #134

cooljoseph1 opened this issue Apr 24, 2020 · 4 comments
Labels

Comments

@cooljoseph1
Copy link

cooljoseph1 commented Apr 24, 2020

One can estimate the number of total pawns on its team by using the id() function.

import random

a = []

def turn():
    global a
    a = [random.random() for i in range(999)]

    log(str(id(a[-1])))
    
    board_size = get_board_size()
    team = get_team()
    opp_team = Team.WHITE if team == Team.BLACK else team.BLACK
    robottype = get_type()

    if robottype == RobotType.OVERLORD:
        if team == Team.WHITE:
            index = 0
        else:
            index = board_size - 1

        for i in range(board_size):
            if not check_space(index, i):
                spawn(index, i)
                break

    else:
        pass

What's happening is that 999 new objects are created each time the turn function is run. This causes the id's to increase over time, and so by comparing the id's from last turn to the most recent turn, the robot can estimate the number of robots on its team.

@cooljoseph1
Copy link
Author

cooljoseph1 commented Apr 24, 2020

This exploit is similar to this:
#111

@cooljoseph1
Copy link
Author

cooljoseph1 commented Apr 24, 2020

Looking more into it, I've found that the id values are rather inconsistent, so it probably wouldn't work very well.

@arvid220u
Copy link
Contributor

this is very interesting! but yeah, it seems too unreliable for me as well

@arvid220u
Copy link
Contributor

anyways, it seems like we should just disallow id. there's no real reason to have it around and it does potentially expose things

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

No branches or pull requests

2 participants