HNHacker News
TopNewBestAskShowJobs

_g2lm

1 karma · joined October 30, 2023

submissionscomments
_g2lm··on Show HN: Is My Website Taken?
Disclosure: I made this site explicitly as an alternative to instantdomainsearch. So far, I like my UI better (who doesn't love angry bears?), but they appear to be faster still...
_g2lm··on Show HN: Game where you write Python robots to fight other players
Sorry to hear that :( I'm working day and night at the moment to get this back up and running. Want me to shoot you an update when it's ready?
_g2lm··on Show HN: Game where you write Python robots to fight other players
That sounds like the much more fully developed version of what I have that I'd like to get to someday. I'm down for that collaboration thing. Let's get a group started.

The radios you mentioned are something I'd like to have someday. I think what makes games like these cool is the fact that your code controls an army of robots. It's more fun than just having two robots duel it out.

_g2lm··on Show HN: Game where you write Python robots to fight other players
Wow, great work. Mind if I steal this? And yeah, I'll open-source it pretty soon.
_g2lm··on Show HN: Game where you write Python robots to fight other players
You can preserve state between turns; it's the same Robot object being called. Thanks for the suggestion though, I'll try to make that a feature.
_g2lm··on Show HN: Game where you write Python robots to fight other players
The problem is that he managed to essentially bypass my jail. He could've wiped my server if he'd wanted.
_g2lm··on Show HN: Game where you write Python robots to fight other players
Could you please elaborate a little?
_g2lm··on Show HN: Game where you write Python robots to fight other players
I 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[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.
_g2lm··on Show HN: Game where you write Python robots to fight other players
Thanks for the tip. I updated the instructions.
_g2lm··on Show HN: Game where you write Python robots to fight other players
Sorry, the games weren't being run for a bit. I was only catching security exception and one game threw some other exception, which crashed the whole process. I restarted it and now it should be working.
_g2lm··on Show HN: Game where you write Python robots to fight other players
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?

_g2lm··on Show HN: Game where you write Python robots to fight other players
Right you are. Let me add that.
_g2lm··on Show HN: Game where you write Python robots to fight other players
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

_g2lm··on Show HN: Game where you write Python robots to fight other players
Thanks for the idea! Yeah, I'm thinking it would be ideal if eventually there could be some kind of IDE on the site with simulator and all (like on fightcodegame.com).
_g2lm··on Show HN: Game where you write Python robots to fight other players
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.

_g2lm··on Show HN: Game where you write Python robots to fight other players
Any suggestions for the language? The game and site are written in Python so that seemed most natural, plus it's a high-level language with a simple syntax. I could add more if people wanted though.
_g2lm··on Show HN: Game where you write Python robots to fight other players
Yeah, that's the game data (zlib + base64). I'm working on making some sort of replay viewer in JS.
_g2lm··on Show HN: Game where you write Python robots to fight other players
Also, sorry about the slow load time. I didn't expect people to visit and now the server's in trouble.
_g2lm··on Show HN: Game where you write Python robots to fight other players
Hey, saw your robot. (Freaked out that someone actually submitted a robot over 2k characters.) Trying to fix the issue right now. Thanks!
_g2lm··on Show HN: Game where you write Python robots to fight other players
This game is still pre-alpha. If anything breaks, please just post it here and I'll probably see it faster.
_g2lm··on [dead]
That's exactly my problem. I work well on my own and prefer it, but I want to change. I'm building stuff on my own right now and will continue doing so, but I realize there's no way I can run a company by myself forever.
_g2lm··on [dead]
Yeah, I want to meet people. I'm trying to learn too, but I can go on udemy/coursera from anywhere.
_g2lm··on [dead]
Right, my bad.
_g2lm··on Ask HN: What wireframing tools do you use?
What do you like and dislike about it?
_g2lm··on Ask HN: Why do people think Macs are terrible for hacking?
I'm going to get a Mac anyway (well, I would if I had the money). I'm just wondering why people think the Mac sucks for hacking. Did it suck initially?
← PreviousPage 2 of 2