My Pet Project: Snake Game

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

awr7126
Posts: 22
Joined: Sun Jan 09, 2011 5:32 am UTC

My Pet Project: Snake Game

Postby awr7126 » Sun Jan 09, 2011 8:02 am UTC

I am trying to write a program that will play the snake game for me and get a really high score.

I have posted on several other programming forums to get help on specific parts of the program. But I'm kinda stuck and do not know where to go from here.

Anyone who is reading this presumable has programming knowledge and some free time. So if you would like to take a look at my code and offer any suggestions, that would be great!
Last edited by awr7126 on Sun Apr 07, 2013 9:33 pm UTC, edited 1 time in total.

User avatar
sparkyb
Posts: 1091
Joined: Thu Sep 06, 2007 7:30 pm UTC
Location: Camberville proper!
Contact:

Re: My Pet Project: Snake Game

Postby sparkyb » Wed Jan 26, 2011 1:29 pm UTC

I was just talking to a friend of mine doing a similar project for a different FB game. The best way to one-up your friends with an unfairly high score is not by writing a bot that had to play the game. It is much easier to just submit a fake score without playing. Start by downloading and decompiling their flash files and reading the source ActionScript. My favorite free ActionScript decompiler is Flare. Also Wireshark for analyzing the network traffic. One option is to figure out how it sends the score and send a similar packet yourself. It might be tough if the data is signed for security, but if you can find where it the decompiled code it does the signing you might be able to spoof that yourself. The other option is to find where the game keeps your score in memory when it is running and modify it in memory so the game sends up the wrong score. This is how my friend did it with the game he was trying to beat his friends at. He said he used a programmed called Cheat Engine for finding and changing the score variable in memory.

awr7126
Posts: 22
Joined: Sun Jan 09, 2011 5:32 am UTC

Re: My Pet Project: Snake Game

Postby awr7126 » Wed Jan 26, 2011 1:39 pm UTC

Ah; That would be easier. I guess that is how some people get ridiculously high scores on some games.

User avatar
sourmìlk
If I can't complain, can I at least express my fear?
Posts: 6393
Joined: Mon Dec 22, 2008 10:53 pm UTC
Location: permanently in the wrong
Contact:

Re: My Pet Project: Snake Game

Postby sourmìlk » Wed Jan 26, 2011 11:50 pm UTC

awr7126 wrote:Ah; That would be easier. I guess that is how some people get ridiculously high scores on some games.


Depends: is that max score something like 2^31 - 1?
Terry Pratchett wrote:The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.

squareroot
Posts: 548
Joined: Tue Jan 12, 2010 1:04 am UTC
Contact:

Re: My Pet Project: Snake Game

Postby squareroot » Wed Jan 26, 2011 11:57 pm UTC

sourmìlk wrote:
awr7126 wrote:Ah; That would be easier. I guess that is how some people get ridiculously high scores on some games.


Depends: is that max score something like 2^31 - 1?


Usually. Sometimes, it's not - I've seen much larger scores than that.
I'm guessing it depends on how it's processed, which seems to vary from game to game (I'm think MindJolt right now, which is probably the biggest provider of FB Games)
<signature content="" style="tag:html;" overused meta />
Good fucking job Will Yu, you found me - __ -

User avatar
sourmìlk
If I can't complain, can I at least express my fear?
Posts: 6393
Joined: Mon Dec 22, 2008 10:53 pm UTC
Location: permanently in the wrong
Contact:

Re: My Pet Project: Snake Game

Postby sourmìlk » Wed Jan 26, 2011 11:59 pm UTC

squareroot wrote:
sourmìlk wrote:
awr7126 wrote:Ah; That would be easier. I guess that is how some people get ridiculously high scores on some games.


Depends: is that max score something like 2^31 - 1?


Usually. Sometimes, it's not - I've seen much larger scores than that.
I'm guessing it depends on how it's processed, which seems to vary from game to game (I'm think MindJolt right now, which is probably the biggest provider of FB Games)


If they're using unsigned ints it could be as much as 2^32-1. Or they could be using unsigned longs where it might be 2^64-1. What's the highest score?
Terry Pratchett wrote:The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it.

awr7126
Posts: 22
Joined: Sun Jan 09, 2011 5:32 am UTC

Re: My Pet Project: Snake Game

Postby awr7126 » Thu Jan 27, 2011 12:51 am UTC

A lot of the scores just seem arbitrarily high. Not powers of 2 at all.
Last edited by awr7126 on Sun Apr 07, 2013 9:34 pm UTC, edited 1 time in total.

User avatar
Emu*
Posts: 689
Joined: Mon Apr 28, 2008 9:47 am UTC
Location: Cardiff, UK
Contact:

Re: My Pet Project: Snake Game

Postby Emu* » Thu Jan 27, 2011 12:24 pm UTC

Watch out for displayed scores ending in 0 actually being stored as the smaller number then multiplied. No-one likes seeing single-digit scores in games.
Cosmologicon wrote:Emu* implemented a naive east-first strategy and ran it for an hour, producing results that rivaled many sophisticated strategies, visiting 614 cells. For this, Emu* is awarded Best Deterministic Algorithm!

User avatar
Squid Tamer
Posts: 220
Joined: Fri Apr 03, 2009 3:59 am UTC
Location: Over there
Contact:

Re: My Pet Project: Snake Game

Postby Squid Tamer » Mon Jan 31, 2011 2:31 am UTC

This reminds me of when I tried to do this for a game that only requires you to click as fast as possible. I thought that it was obvious script-fodder, so I cobbled together something using a linux macro program. (It's nearly impossible to easily make a mouse click event in Linux, as far as I can tell.)

I got a wonderfully high score, and posted it to my wall. Then one of my (Average technological skill, meaning l33t MS Word skillz!) friends did it. They got a score that was many times higher than mine*. Never underestimate the power of a over-caffeinated flash-gamer when writing cheating scripts.

I'd like to try again now that I have some C++ experience.
*Due to the way the game worked, that does not necessarily mean that that they had to click several times faster than the macro.

awr7126
Posts: 22
Joined: Sun Jan 09, 2011 5:32 am UTC

Re: My Pet Project: Snake Game

Postby awr7126 » Mon Jan 31, 2011 4:08 am UTC

thanks


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 4 guests