I am new to programming, I've completed the code academy python course but don't really know where to start.
Show HN: Game where you write Python robots to fight other players
41–50 of 102 posts
Re: Show HN: Game where you write Python robots to fight other players
#42Brandon - 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
Re: Show HN: Game where you write Python robots to fight other players
#43Re: Show HN: Game where you write Python robots to fight other players
#44I'm still waiting for Code and Conquer... :(
Re: Show HN: Game where you write Python robots to fight other players
#45 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
#46Haven'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.
Re: Show HN: Game where you write Python robots to fight other players
#47Re: Show HN: Game where you write Python robots to fight other players
#48I 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.
Do you have a link to your project?
Re: Show HN: Game where you write Python robots to fight other players
#49Re: Show HN: Game where you write Python robots to fight other players
#50Haven'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.
it'd give me a reason to log back in