Posts tagged game botting

Botting Scrabble Boggle for Fame and Fortune

This is a followup to an earlier post about botting Flash games.

Arguably the easiest game to bot on WorldWinner / GSN Cash Games is called Scrabble Boggle.

scrabble-boggle

This is a post about my bot to play this, showing off a demo video, a little bit about how it works, and what scores are believable for us humans.

And the title? I really might be famous in the WorldWinner risk department. They let me keep half my bot winnings ($60 🙂 ).

Video demo

What are human scores like?

My take - a good human score for this game is about 300.

With a Boggle solver open in another tab, you might be able to crack 900.

This bot I'm releasing can exceed 5000. I know, because I did it and got banned.

worldwinner-ban-facebook-message

Keep it under 5000, guys.

How does the bot work?

Using image recognition - you'll see a folder full of letter images - it figures out what letters are on your screen and where on the board they are.

The bot has a list of official Scrabble words. Using some recursion, it figures out every valid word that can be made on your board.

Finally, with a GUI automation library, it automatically enters the valid words for you. It will do this indefinitely until you move the mouse to the upper left corner of the screen.

(The Github repo has more technical details like the specific Python libraries, etc)

Can this make money?

As far as I know, this game is still up on WorldWinner. I'm of the opinion that they should remove this game from their site because of how easy it is to automate. You'll see a lot of players with scores higher than those I described as being humanly possible above.

But until that happens - in theory you can go there right now and pit this bot against humans.

Cautionary closing

The Github repo has the code and some instructions on getting this to run.

I've mentioned this before - WorldWinner banned me for getting crazy with the bot. They really should remove this game and maybe this release will drive that.

worldwinner-ban

WorldWinner ended up refunding me about half my account balance, which still resulted in some profit from the bot's performance. This genuinely surprised me and I wouldn't take that for granted. Assume no payouts if you get banned.

Intro to Botting Flash Games

Recently I've been enthused with botting Flash games. It's a good software engineering exercise, and can make you some money.

To get this definition out of the way - a "bot" is a computer program that plays a game for you.

game-bot-wins

Approaches to game botting

I see three approaches to botting a Flash game.

1 - interpret the screen with computer vision algorithms, then program clicks or keystrokes to happen after that in a loop. This is probably the most "human" method.

2 - read memory values to interpret the game state, then program clicks or keystrokes to happen after that in a loop. A "hybrid" approach between the previous one and the next one.

3 - script the reading and alteration of memory. Here you're essentially not playing the game at all, just hacking it. Like you could locate the memory value for your score, change it to whatever, and then carry on.

For the sites I'm about to mention, since you're playing for money, #3 won't work. There's a lot of server-side pinning of values. Altering the game in the #3 approach will only affect the client.

Fellow nerds might ask "can't I just intercept and modify the traffic with Wireshark or Fiddler?!?" Try it and see how little information you get from the Flash stream.

Approach #1 is what I've had success with thus far. #2 becomes difficult because you're trying to locate all these values in memory and God knows what they are.

However, I will recommend Nick Cano's excellent book which applies mostly to approach #3 (sort of #2 also). He signed a copy for me at Defcon 24. Great read on memory manipulation and more.

game-hacking-nick-cano
Image credit - No Starch

Why this is a great programming exercise

You've got computer vision algorithms to write for game state interpretation, back-end algos for figuring out what to do in the game, then keystrokes and clicks to script. Maybe your bot's workable at that point but you run into issues - time for optimization. And how do you know if it's working? Unit tests. How do you know if it's slow? Benchmarking.

Game botting just really engages the full breadth of software engineering. Plus the money aspect can incentivize you a bit. 🙂

Where to bot games for money

The obvious answer to this question would be online casinos. You could skirt present online gaming laws (for the U.S.) by choosing Bitcoin casinos and/or using a VPN.

However, casino games have an edge built into them. The best skilled players would still have a hard time making a profit. You can count cards all you want in 8-deck blackjack, it's not going to matter.

On our topic of Flash games, there are a couple reputable sites where players engage in "casual" games against each other. Each puts up a little money before hand, and the winner makes out. The host website takes a rake off the pot like poker.

Example - Player A pays $0.88, player B pays $0.88 then they play their game. Player A wins and receives $1.30. The host website made $0.46 off the match up.

And here are the sites.

Worldwinner.com - this is affiliated with GSN, the game show TV network.

Royalgames.com - this is affiliated with King Games, the firm that brought you Candy Crush Saga and some other well-known phone games.

These are where you could potentially profit off of making good Flash game bots.

I've read various complaints that these sites will freeze your money if they suspect you of botting. I cannot personally confirm this.

worldwinner-soft-ban

Closing

I hope this is enough to get you going for now. Be on the lookout for source code and video from me in the future.

The Language of Skynet

A new Terminator movie comes out tomorrow, presenting an opportunity to discuss a controversial AI topic. Especially now with the whole drones / LAWS tug-of-war.

Skynet -- a war-fighting superintelligence -- is a "sexy" computer science project if there ever was one. I want to look at what it is from a technical perspective, what the real-life roots of such a system may be, how to feed it data, and the logical issues involved.

skynet-terminal
Image credit - Jake Sargeant's Vimeo

What is Skynet?

From the Terminator Wikia page:

Skynet is the world's first Automated Defense Network ... It is the controlling force behind all of the battle units. It pools data from battle units, develops tactics and coordinates attacks.

It's the antagonist of the franchise, viewing humanity as a threat and hence fighting against it. Let's ignore that for now.

A working definition: automated defense program that pools data from battle units, develops tactics and coordinates attacks.

How about a nice game of chess?

In the short-lived Terminator TV show, a very preliminary version of Skynet was a computer called 'The Turk.'

It's alluded that, although the machine just plays chess, it's more of a general game player:

Andy describes the Turk 2 in a way that could also apply to Skynet and the Terminator AI: having a hunger for learning but not always learning the right lessons. Terminator Wikia
Image credit - Terminator Wikia
Image credit - Terminator Wikia

General game playing is an exercise in AI programming. Instead of coding something that just plays chess or specializes in one game, you're coding something that can play any game.

So how does that work? There's a whole MOOC on it, but basically:

  • Two parties are connected by a server. Could be a GGP with a human, or two GGPs.
  • Server will monitor moves for validity, inform parties of state changes, and provide initial data.
  • Initial data contains the rules, in Game Description Language, plus the starting state.
  • Rules include conditions of success -- how to know there's a winner.
  • Game commences. For each move, the GGP applies some kind of algorithmic logic like Monte Carlo.

If you're into technical material, check out Hilmar Finnsson's Generalized Monte-Carlo Tree Search Extensions for General Game Playing (pdf link).

The WOPR from 1983's WarGames was a general game player repurposed for military applications.

Image credit - Ross Kingsland
Image credit - Ross Kingsland

The fuel of general game playing

Data. No matter how fancy you get with algorithms, GGP relies on data.

It needs just enough to get started. Rules and initial state.

IBM has a paper on "general description language" (pdf link). Versatile modeling language for conferring complex designs.

Game Description Language is the most common data format for GGP systems. However, there was a commercial program called Zillions of Games that had its own language. And yet another system called Metagame with another language.

As far as I'm concerned, these 3 languages for describing games are a subset of general description language. They confer complex design... of games.

Adaptable AI systems need to be fed information in this sort of way. Standardized format capable of describing what's pertinent to them.

For game playing, that's any game in the universe. Even ones that haven't been invented yet.

What does every game have? Going to the most fundamental traits:

  • Roles / players
  • Initial state
  • Possible moves
  • State updates
  • Terminal conditions
  • Goal state

Add syntax and you can describe any game to a machine.

Image credit - Zillions of Games
Image credit - Zillions of Games

General Warfare Description Language

Skynet is more concerned with war than games. To program it, you would need some kind of General Warfare Description Language.

Military technology is evolving rapidly. Tomorrow's nukes could be antimatter weapons, tomorrow's firearms could be directed energy.

This language has to rely on absolute fundamentals so as not to become obsolete. Examples:

  • Entities - outside of the system's direct control, like human soldiers and manned vehicles.
    • Friendly
    • Hostile
    • Civilian
    • Uncertain
  • Units - directly controllable by the system, like instances of LAWS. (pdf link to CSS analysis)
  • Methods - components of units with the capacity to affect entities, like firearms.

By no means is this comprehensive. If one were to build Skynet, it would have to be.

Issues with a GGP-based Skynet

The "pools data from battle units" part isn't too complex.

Fledge out General Warfare Description Language or something like it.

Start streaming data into it. Presumably most, if not all, surveillance is digitized in a mass processable way.

"Develops tactics and coordinates attacks" is where things get dicey. That's where the Lethal Autonomous Weapons Systems arguments are currently at, and where campaigns like Stop Killer Robots are coming from.

In the Terminator battle, things are fairly polarized. Humans versus machines. Each wants to wipe out the other.

Machines: scan with pyroelectric infrared sensors. Human? Shoot.

Humans: is that a machine or one pretending to be a human? Shoot.

Real life isn't like that. It's harder to teach a machine what to do.

Image credit - heavyarmor.wordpress.com
Image credit - heavyarmor.wordpress.com