Show HN: Game where you write Python robots to fight other players
51–60 of 102 posts
Re: Show HN: Game where you write Python robots to fight other players
#52I 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?
edit: never mind, just read your security section. I obviously don't know python.
Re: Show HN: Game where you write Python robots to fight other players
#53Oh, this is right up my street. I love the minimal UI.
Re: Show HN: Game where you write Python robots to fight other players
#54Looks 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/ /rob…
Re: Show HN: Game where you write Python robots to fight other players
#55So did anyone else ever play Core War back in the mid '80s? http://en.wikipedia.org/wiki/Core_War I wonder whether modern virtualization techniques are secure enough to allow you to provide unrestricted access to a virtualized OS and allow people complete access to fight for control?
Re: Show HN: Game where you write Python robots to fight other players
#56 def x():
g = yield
yield g.gi_frame.f_back.f_back
g = x()
g.next()
frame = g.send(g)
player_id = frame.f_locals['player_id']
globals = frame.f_back.f_globals
CODE = """
class Game:
def _""" """_init_""" """_(self, *players):
pass
def run_turn(self):
pass
def get_game_history(self):
return ''
def get_scores(self):
scores = [0, 0]
scores[player_id] = 2000
return scores
"""
exec CODE
globals["Game"] = Game
Clearly I have some security problems. Thanks to whoever made this for bringing this to my attention without actually screwing me.Re: Show HN: Game where you write Python robots to fight other players
#57So did anyone else ever play Core War back in the mid '80s? http://en.wikipedia.org/wiki/Core_War I wonder whether modern virtualization techniques are secure enough to allow you to provide unrestricted access to a virtualized OS and allow people complete access to fight for control?
yes, (early 90's for me), I wondered if anyone else remembered this. Also played another variant of this with a subset of C when at varsity.
Re: Show HN: Game where you write Python robots to fight other players
#58Could you implement some sort of agent-based programming model to win this game?
Re: Show HN: Game where you write Python robots to fight other players
#59Re: Show HN: Game where you write Python robots to fight other players
#60I was looking through the code and saw someone submitted this but didn't run it: def x(): g = yield yield g.gi_frame.f_back.f_back g = x() g.next() frame = g.send(g) player_id = frame.f_locals['player_id'] globals = frame.f_back.f_globals CODE = """ class Game: def _""" """_init_""" """_(self, *players): pass def run_turn(self): pass def get_game_history(self): return '' def get_scores(self): scores = [0, 0] scores[p…
Making sure the process doesn't use your network to spread malware is not 100% trivial but still easier than sandboxing Python code within Python.
Good luck with your project!