Web game bot coded with Python

We find the programming challenge of game-playing bots to be fascinating. Take a look at this Python bot which plays Burrito Bison all the way through (video after the break). This is a totally pedantic exercise which has no purpose, other than to hone your mastery of a certain programming problem. And to that we say Bravo!

We looked in on a similar project which used some C# code to dominate the game Bejeweled Blitz. We’re not fantastic at C# and that code was never made public. But [Audionatics] has released this code through Github, and it’s written in Python which is a language in which we’re well versed.

The script monitors pixel locations to use as an input, which [Audionautics] admits is very error-prone. But if everything is setup just right it works like a charm. He’s also using the PyWin package which we believe is what lets the script move the cursor and register button clicks. We think this is really fun, but it make us wonder about the black-hat possibilities. What are the chances this could be turned into a gambling bot? Scary thought, huh?

[via Reddit]

Comments

  1. lamalala says:

    I would love to see a bot excel at QWOP

    http://www.foddy.net/Athletics.html

  2. veneficus says:

    Gambling bots, helpers etc. already exist. Just because you can use a bot to play doesn’t give you an edge on the probability as it is controlled by the server. However, If you can login with multiple accounts to the same poker table for example, it could improve your odds.

    • Artanis says:

      Unsurprisingly, poker sites are not stupid and already search for suspicious things like that.

      Coding something that can play in some online poker site or standalone poker program is very time consuming but easy(not just “relatively easy”, plain easy), the problem is coding something that will actually make money. You need to take into account losing streaks(due to the randomness of the cards), entry fees per game, the skill of the other players(unless you use a LOT of accounts, you wont make money in the pennies tables), … it’s not easy at all from a mathematical point of view.

      • ARoss says:

        This guy seems to understand programming fairly well, but apparently is less well versed in poker and the AI tech that would involve playing it. Online poker isn’t 007’s Casino Royale, you’re not playing your opponent nearly as much as you are playing the odds based on your hand and the cards shown.

      • John says:

        Actually, if you program it to play tournament mode you can place fairly regularly. In large player pools you barely look at the other person at all, because you swap so frequently. You are better off playing extremely defensive, and only staying in a hand if you are in the top three possible hands.

        Just waiting will be enough to place, as the blinds rarely keep up with people’s impatience. And in this instance lower denomination entries would be better, as people are less likely to play defensively.

      • Artanis says:

        I understand than playing online poker is no “casino royale”, but coding an IA to do it is harder than it seems. You can play by the odds all the time, but what odds? where do you set the threshold of when to check/fold/raise? select a threshold too high and you the amount of money you win wont cover your loses in the other X games where you did not satisfy that condition. Set a threshold too low and you will lose more hands than you win, leaving you with no gain(or overall loses). And you cant really really fix it on the fly because a winning-losing streak would pollute your predictions.

        It’s easy to do a simple bot that can win in no money or pennies-dollar tables, but above that your bot wont be the only one in the table playing the odds so things get harder.

        You could do a simple bot that self adjusted it’s weights based on success/failure, but that would take months to be profitable while losing money during all that time.

  3. Lachlan says:

    If you guys are interested in a pixel, bitmap or DTM detection based bots I recommend checking out SCAR / Simba at http://villavu.com for many years programmers of SCAR have been solving the Anti-bot “random events” that occur in the game RuneScape. It has been a struggle creating solutions for all of the measures the game company designs to stop these bots.

  4. deltacoding says:

    I once dumped around 4Gb of records from a Bloomberg terminal using VNC and a python script crafted pretty much like this one.

    darn, how I miss old days..

  5. Skitchin says:

    ForEx trading bots! Of course, even if you could give it enough data to make it profitable, it’s not like you’d SHARE it.

  6. roboman2444 says:

    This reminds me of the Runescape bots. I think now they monitor the data coming in and out of the client, but they used to do image analysis to figure out what to click on.

    • notmyfault2000 says:

      There are some bots that simply hook into the bytecode and directly look at the in-memory objects and fire off events like mouse movement and keyboard presses directly to the game. This gives the ability to run dozens of bots from a single computer. Runescape being in Java apparently makes this job so much easier.

      Last I heard RSBuddy had a system that automatically went through a new RS update’s bytecode, found all of the needed hook points (and bot traps), compiles a new bot client taking these into account, and pushes the update to the users.

      I may be misremembering though, it was a while back when I messed around with it.

  7. CG says:

    Fun game! And beatable too. Not one of those endless one click games.

  8. McDirty says:

    For the life of me I am trying to recreate this bot with proper versions of python, all modules included and I got the bot running. However I cannot seem to get it to recognize the game properly. It just keeps searching. Any thoughts?

  9. cwbh10 says:

    Is there another library like PyWin for Mac OS X? I’m quite intrigued by this project, and I really prefer to work/develop on a Unix-like system + Mac is pretty GUI :3

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 93,633 other followers