Professor Mouse

Here’s an interesting little script I found in an old backup.  It plays a perfect game of ‘Professor Mouse’ on Game Duell [sic].  Here’s a screen shot from the game:

To score points, you must find strings of letters which make valid words – the longer the word, the more the points.  Any direction to an adjacent touching tile is valid.   To progress to the next level, you must find a word for each pattern given in the right hand column.  For example, a suitable word for the last pattern ?A???? is, among others, MANAGE, at position (4,3) in (x,y) coordinates, where (1,1) is the top left tile.

Worryingly, Game Duell allows people to play for real money.  After losing to truely gargantuan scores game after game, I suspected foul play.  So, I decided to investigate how easy it would be to write a program to play for me.

Disclaimer: needless to say, I never used this to actually play for real money, which would clearly break the Game Duell ToC.  This was a proof of concept, only tested on the free games. I have not released the source code of the script and have no plans to do so in the future.

Anyway, here’s the script in action, playing the game board above:

jack@desktop:~/prof_mouse$ php run.php
Enter current level in the game (i.e. 1, 2 or 3):3

Screenshot taken.
Locating game board... Found at 1224,471!
Reading game board...


Letters loaded. Searching for words... Best words:
Notable word: DENSEST [6,6]
Notable word: TENSEST [5,6]
Notable word: MENAGES [4,6]
Notable word: MANAGES [4,3]
Notable word: MESSAGE [4,3]
*SUPER* word: MESSAGES [4,3]
Notable word: GAMETES [3,5]
Notable word: SESAMES [3,3]
Notable word: SWIGGED [2,7]
289 words found in total!

Enter wildcard to search for (e.g. ?A???):?A????
SASSES found at: [6,4]
NASSER found at: [5,4]
BASEST found at: [5,2]
BASSES found at: [5,2]
MANSES found at: [4,6]
MASSES found at: [4,6]
SAGEST found at: [4,4]
MANAGE found at: [4,3]
GAMEST found at: [3,5]
GAMETE found at: [3,5]
GASSES found at: [3,5]
GASSER found at: [3,5]

The script finds the coordinate of the game board  and segments it into each letter.  Each letter is then passed into GOCR with parameters to specify the character must be uppercase A-Z (this results in 100% accuracy).

Finally I made an algorithm to find strings of letters which satisfy the rules and form valid words found in a dictionary.  The script then prints out the highest scoring words and their positions in the game board and allows you to make search queries such as ?A????, to find a suitable word such as MANAGE.

The script solves the board in about a second (there would be plenty of ways to dramatically improve this speed, but one second is good enough!).  It would also be trivial to output mouse movements and clicks to fully automate the playing.

So, the game is clearly very susceptible to cheating… this took an evening to hack together.  I wouldn’t recommend people play for real money!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>