Show HN: Game where you write Python robots to fight other players
11–20 of 102 posts
Re: Show HN: Game where you write Python robots to fight other players
#12interesting! Question regarding the security restrictions - why disable built-ins such as `all`, `set`, `list`, `enumerate`, `min`, `sum`, `sorted`, etc?
https://pypi.python.org/pypi/RestrictedPython
I realize this is annoying, and ideally I shouldn't even be doing this. It was just a quick hack for the version 1. I'll probably try to run user scripts in something like Docker. Any suggestions would be appreciated.
Re: Show HN: Game where you write Python robots to fight other players
#13Re: Show HN: Game where you write Python robots to fight other players
#14interesting! Question regarding the security restrictions - why disable built-ins such as `all`, `set`, `list`, `enumerate`, `min`, `sum`, `sorted`, etc?
To be honest I copied it from `safe_builtins` from RestrictedPython: https://pypi.python.org/pypi/RestrictedPython I realize this is annoying, and ideally I shouldn't even be doing this. It was just a quick hack for the version 1. I'll probably try to run user scripts in something like Docker. Any suggestions would be appreciated.
Re: Show HN: Game where you write Python robots to fight other players
#15Hey, I think something that would make the experience a lot better would be to incorporate Ace editor into it, so you get a very well-featured editor incase you don’t have easy access to a better-than- editor.
Re: Show HN: Game where you write Python robots to fight other players
#16Have you checked out https://www.hackerrank.com/ ? They initially started out with bot challenges as well.
Re: Show HN: Game where you write Python robots to fight other players
#17Re: Show HN: Game where you write Python robots to fight other players
#18Brandon - what methods are you using to run untrusted Python code in a secure sandbox?
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
Re: Show HN: Game where you write Python robots to fight other players
#19python kit/run.py yourcode.py yourothercode.py map.py --render
is required to view the simulation. The "--render" argument doesn't seem to be mentioned anywhere on the site.
Re: Show HN: Game where you write Python robots to fight other players
#20This game is still pre-alpha. If anything breaks, please just post it here and I'll probably see it faster.