Showing posts with label Macro. Show all posts
Showing posts with label Macro. Show all posts

Sunday, January 20, 2013

Ruzzle Solver

So today, my friend challenged to a game called "Ruzzle."  He claimed that it was a new popular game that everyone was playing.  I've never heard of it, so I decided to check it out.

It turns out it's just a relabeled Scramble with Friends, which was popular around a year ago.  I find it quite funny that a game can resurface like this, just under a new name.  There's no new content, except for advertisements.

Around a year ago, when my friend first introduced me to Scramble with Friends, it was sort of fun, but I figured out something very important: I suck at the game!  So, I did as any normal person would do.  I got sick and tired of always losing to my friend.  I decided to go for the fame and the glory.  I made a bot.

Now, I decided to write a blog post (which I haven't done in quite some time) because I uploaded it to MediaFire, where I store all my uploaded files.  Since I'm slightly OCD about this, I want everything on MediaFire to be linked with something on this blog.  (And perhaps because I wanted to share this awesome secret with other people, although I'm sure that there are other Ruzzle solvers out there.)

Anyway, what this program does is find all of the words in the puzzle and output them, sorted from highest to lowest in letter count.  It doesn't take into account the "Double Word Score" or "Triple Letter Score" bonuses, but I imagine if you just type the longest words, they'll contain most of these bonuses anyway.  And they are huge freakin' words so they'll still give you massive points, right?

Most of my released programs are pretty "refined," or at least look like they are finished and and don't have random buttons and stuff lying around, but I decided to just leave this one in it's current state.  Needless to say, don't press the buttons that have weird names -- even I'm not sure what they do anymore.

To use this is extremely simple:
  1. Type the letters on each line into the only TextBox without spaces, so just go from left to right, and then from top to bottom, as the prompt suggests.  There should be 16 letters in the TextBox when you're done, and nothing else.
  2. Press "Go!!!" and a Notepad (or whatever your default text editor is) should pop up, containing the aforementioned list of words.
  3. Input them into the game as fast as you can.
  4. Win games.
UPDATE:  For some reason or another, I recently updated it to have three output options (you can check any or all of them).  The link at the bottom is also updated.
  • Sort:  outputs the sorted list, as it used to
  • Tile: outputs the words for each tile as a starting location, starting with the top-left one, going across and then down.  Each sub-list is sorted on word length.
  • Filter (5+):  same as "Tile" except that it only includes words that are 5 letters or longer to reduce the clutter when going down the list, since there's no way to input all the words in only two minutes.
Now, while I didn't release any source code because it is so messy I'd be embarrassed if anyone saw it, there is one very small customization that you can do.  The program uses a dictionary, or rather, list of words that it searches for during run-time.  It's possible for you to swap out word lists by just copying a new one into the same directory as the executable, and naming it "DICT.txt".  One thing to keep in mind, though, is that I do not know what the Ruzzle word list actually is, so an oversimplified word list will not get you all of the massive points, and an over-complicated word will probably give you words that Ruzzle will not accept.  Maybe you can find the official word list, but I'm too lazy to find it right now.

Have fun beating all your friends at Ruzzle.  It's easy to trick them into thinking you're a pro at this game!  I've done it twice now!

Just follow the link to download the file.  Extract it and run the executable.  It's easy as that!

Wednesday, December 29, 2010

FarmVille Bot

FarmVille is this "popular" game on Facebook.  In a nutshell, you're a farmer, and you just have to plant and harvest crops to level up.  It's a surprisingly addicting game.  However, the one turnoff is that it takes so long to individually click each field (those who play the game know what I'm talking about).  It can take up to 30 minutes if you have a large enough farm.

This program uses several of the C# classes I posted on my blog earlier:
C# Mouse
C# InputBox
C# FileSystemDialog

It also a class I made up for this program called the Location class.  If you want to look at it, then just download the source code (at the bottom of this post).

I developed a pretty easy to use tool for working on your farm (it works best if you have just a massive square of fields).  Refer to the image below:


What you have to do is tell it how many rows and columns of fields it has to work on and where the four corners of the rectangular region you want to harvest are.  TOP means the top-most field, LEFT means the left-most field, RIGHT means the right-most field, and BOTTOM means the bottom-most field.  I'm pretty sure you could have figured that one out.  To set these values, you have to select one of the boxes, and press space when your cursor is over the respective field.  The program will automatically rotate the selection counterclockwise, so I recommend starting at the TOP box and then going LEFT, BOTTOM, and RIGHT.  Also, I think it's best that you go to the market and select any crop so that you have your actually mouse pointer when you're setting these values.

The program will not click on the field indicated in the exceptions box.  Click "Add" to add an exception to the field given by the row and column in the rectangular region.  Keep in mind that the left-most field is at row and column 0 (ZERO).  For example, you'd use this to skip over the square that my guy is standing in at the center.  By the way, it's best that you fence in your character using hay bales so that he doesn't have to walk over to the fields to work on them.  It saves a lot of time.

Just hit the "Go!" button to begin the operation!  Watch as the program does all the work for you.  However, you can't minimize the FarmVille window until the program is done clicking on all the fields.  If it misses a few fields, you can probably click them yourself and then tweak the corner locations later.  If it totally fails, then you can just minimize the FarmVille window (or show desktop using the Windows Key + D) and then try again.

In the File menu, you can save your farm.  The program will automatically load the file called "Default.fvm" if it exists, so you are going to do the same farm over and over again, save it as "Default.fvm."  You can also load existing farms.  Also, just in case you forgot to save your farm, it creates a file called "LastFarm.fvm" automatically.  It will be overwritten the next time you exit the program, so make sure that rename this file to something else if you want to keep it.  Keep in mind that the program can only read and write .FVM files.

A hint to those who have irregularly shaped farms (that aren't rectangular or square).  You should divide your farm into as few rectangles as possible, and make a save file for each of those rectangles.

You can download the program here ("FarmVille Master.exe").
You can also get the C# source code here ("FarmVille Master.zip").

Have fun winning at FarmVille!