Live data from Hacker News

Show HN: Game where you write Python robots to fight other players

robotgame.org

41–50 of 102 posts

Re: Show HN: Game where you write Python robots to fight other players

#42
post #18

Brandon - what methods are you using to run untrusted Python code in a secure sandbox?

Right now what I'm doing is: 1. search code for double underscores (to block magic methods) 2. replace `__builtins__` with a whitelisted version 3. hook `__import__` to only allow a whitelist 4. hook `getattr` to reject any key containing double underscores

Are you at least running the code in a secured VM, or a Linux sandbox?

Re: Show HN: Game where you write Python robots to fight other players

#45
Looks fun, can't wait to get started. In your instructions, you said to run the program, call:

    python kit/run.py yourcode.py yourothercode.py --render
If you try to run run.py from outside of its directory, it can't import settings.py

    Traceback (most recent call last):
      File "kit/run.py", line 1, in 
        import game
      File "/home//robotgame/kit/game.py", line 30, in 
        settings = SettingsDict('settings.py').d
      File "/home//robotgame/kit/game.py", line 28, in __init__
        self.d = AttrDict(ast.literal_eval(open('settings.py').read()))
    IOError: [Errno 2] No such file or directory: 'settings.py'

Re: Show HN: Game where you write Python robots to fight other players

#46

Haven't had the chance to play around, but it looks clean and it's a nice concept. Have you checked out https://www.hackerrank.com/ ? They initially started out with bot challenges as well.

We still have bot challenges, and can easily host something like, with the added advantage of supporting a dozen other advantages, and a truck load of users.

Re: Show HN: Game where you write Python robots to fight other players

#47
I am working on a marginally similar concept (interface in browser, battles on server) game, but I chose Lua as the scripting language since it is much easier to sandbox. I could not find an effective way to sandbox python for sure, and I am still not 100% on Lua.

Re: Show HN: Game where you write Python robots to fight other players

#48

I am working on a marginally similar concept (interface in browser, battles on server) game, but I chose Lua as the scripting language since it is much easier to sandbox. I could not find an effective way to sandbox python for sure, and I am still not 100% on Lua.

Yeah, I considered Lua but I was stubbornly in love with Python. Judging by the responses on here, I seem to have made a mistake.

Do you have a link to your project?

Re: Show HN: Game where you write Python robots to fight other players

#50

Haven't had the chance to play around, but it looks clean and it's a nice concept. Have you checked out https://www.hackerrank.com/ ? They initially started out with bot challenges as well.

We still have bot challenges, and can easily host something like, with the added advantage of supporting a dozen other advantages, and a truck load of users.

do it :)

it'd give me a reason to log back in

Post reply on HN