Message Boards Message Boards

How to "cheat" on Flash games using Mathematica


A friend of mine has shown to me this Facebook game, 8 ball pool. I particularly don't like playing games, and this pool game has a prediction-line for the balls (which I find it kind of a cheat, since real life pool there no guides). And I thought to myself it I could concoct some code to extend the prediction-line to improve aiming, just as a fun exercise (which in itself is more enjoyable to play the actual game).

Image below shown the extend lines.

enter image description here

And the code:

This part is for positioning. I open the Facebook page in one screen while the other one has Mathematica.

enter image description here

This part is basically cropping the screenshot, making it black-and-white, finding the cue ball and the prediction-line and overlaying it on top of the original image.

enter image description here

This part dynamically takes screenshots and output the overlay image, which is the first image shown in this post.

enter image description here


Although I don't find this type of thing cheating per se since you can achieve basically the same thing putting a ruler on your PC or phone.

But I would advise against cheating on games only on the grounds that it makes the game less fun (that's why I put the code as images and I'm in no way responsible for your use of this code.). This post is only to show another side of Mathematica; with a few minutes of programming, it was possible to "cheat" in a game fairly easily (but buggy-ly).

A better application of this would be to use an NN to play games, training an AI, etc (although the crude application of capturing the screen is a huge bottleneck...)

POSTED BY: Thales Fernandes
1 month ago

Group Abstract Group Abstract