Building a Bot

I have been surveying a bunch of iPhone apps recently. There goes my monthly data charges. Previously I had heard about this game Bejeweled. But I never tried it out until now. The thing is very fun. I have the version called Bejeweled Blitz. Recently I read a tutorial on how to build a bot to win at Bejeweled. Winning means scoring a whole lot of points I guess.

The first decision to make in building the bot is choice of language. Personally I would use C or C++. However the example bot I saw was built with AutoIt. This is a language from Microsoft for creating macros for automation. I think the syntax of AutoIt is kind of like Visual BASIC.

Once you have chosen a language, you need to be able to read Bejewled icons on the screen. Before that you got to figure out the coordinates of the upper right hand corner of the window. Then you must determine the spacing of the icons in the Bejeweled window. The smart breakthrough was to figure out the location on an icon you can test to determine its color.

So far we have been dealing with the easy stuff. Next you need to come up with some Artificial Intelligence to choose the best icons to swap in order to maximize Bejeweled profits. Personally I think you should first swap icons near the top of the screen to ensure the bottom opporunities do not get shifted. However if the bot is considering all possibilities, it should look for longer combos and perhaps double combos.

Bejeweled is so fun that I might just have to try writing a bot to play it for me. The easiest way to do this would probably be to get a version of Bejeweled running on my PC where I have better control of the environment.

Demoscene Alive and Well

I have been watching videos of some 2012 demoscene entries. A lot of them were great. However two of them really stole the show. In fact, they won their respective contests. These are 64kb entries. That is, the code fits in 64kb of memory. They do a lot with a little.

First up is Proton-K by Kewlers. They got a rocket flying out in outer space. The beginning could be a scene right out of Star Wars. I like how the camera rotates around the rocket, causing the light from the sun to be briefly eclipsed. There are some neat effects on the rocket's surface as some weird energy light balls pass through the rocket.

Next up is Gaia Machina by Approximate. I love the scene where the wind blows on the windmill and grass. Hot graphics to say the least. Some weird alien looking legs move through the nature scene. Then just when you thought you had seen it all, the strawberries light up. Freaky good.

Sometimes when I am creating an intro scene for one of my apps, I feel like I am a demoscene participant. I got to make a lot happen in a small amount of time with little code.

Wallhacks and Other Game Cheats

I read an intro article on hacking games via DirectX over at AltDevBlogADay. The essence of the techinques is to intercept the game calls to the DirectX API. Then you can substitute your own evil code in there. The most common of such hacks is the wallhack.

For the wallhack, you wait until a call is made to DirectX with the enemy's position. Then you literally draw a wall around them on the screen. I guess that traps the enemy in the wall. They can't get you or shoot you. Pwned.

Another hack you can do with an enemy location is to draw them a different color. For example, you could highlight all the bad guys in red. This will allow you to visually detect them easier, and shoot them up. Now doing things such as this might get you noticed. And if the game cops catch you, you might be banned. So you need to be sneaky. But that is a story for a future post.

Making Wordpress Fast

I read a detailed account on Ewan's blog on how to set up Worpress to handle 10M hits a day for minimal cost. Part of the instructions are installing software you need for any Wordpress setup: Ubuntu, MySQL, PHP, and Wordpress itself. What is the meat behind the speedup trick? Well it appears to be a combination of some products to accelerate Wordpress usage.

You want to have Nginx for high performance HTTP to start with. Then you add in Varnish, which is an HTTP accelerator. Varnish puts stuff in virtual memory and uses threads to speed things up. Then you add the W3 Total Cache plugin to Wordpress. It uses compression, and as the name implies, caching to really speed things up. It claims to increase the Wordpress throughput a massive 10 times.

One fact I found interesting was the use of Blitz to measure the speed gains. Blitz simulates a lot of users downloading pages from you web site. This all seems the domain of a skilled system adminstrator working on a shoestring budget.

Keygen Details

A rogue virus made it so that I needed to restore my computer to factory settings. I am still reinstalling all my apps. One of the apps kept complaining about a registration key. I ignored it for a while, but it was annoying. So I broke out a key generator.

The main thing of interest with the keygen is that it required me to put in my name. It appears the key is somehow tied to the name. Go figure. The authors of the key generator were able to detect this dependency and add it to their programs.

Can anyone decipher the foreign characters in the image I posted? I am assuming it means cool key generator.

No Laughs for LulzSec

Fox News has reported that five members of LulzSec have been arrested. They have been charged with conspiracy. The arrests include members who go by the code names Kayla, Topiary, Pwnsauce, Palladium, and Anarchaos. Not sure if these are the top dogs in LulzSec, or if this is the entire crew.

The breakthrough happened last year when LulzSec leader Sabu was arrested. His real name is Hector Mansegur. Apparently he has been cooperating with the FBI to arrange the sting on the rest of the members in the group. Now that these peeps are all behind bars, I wonder if the resources will turn toward capturing the greater Anonymous members.

404 Not Found Nginx

My laptop was seriously hijacked recently. Every time I did a Google search, clicking on search results sent me to some other random search site. I could not actually view the search results. When I tried to open the search result items in another tab, I got a page with a "404 Not Found Nginx" page.

I started to do some investigating. Another laptop using the same router as me was fine. This must have been local to my laptop. Then I checked out the hosts file. The thing is usually hidden. But I found some commands to make the file viewable and editable. Nope. That was not how they were intercepting the links.

I ran a bunch of antivirus and antispyware programs. None of them helped. Then I started to run other more agreesive removal programs. The last one made my computer unusable. I could not even restore back to a savepoint. Had to reset the thing to the factory defaults.

Not sure how these spammers took control of my browser. The same thing happened when I used the Chrome browser. I could not directly go to some other Google sites as well. I know these spam pages I was directed to would make some money for the perpatrators.