Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Help me on a fun little project?
1 point by bluemetal on Dec 2, 2009 | hide | past | favorite
Hey HN, this morning I stumbled across a very basic flash version of Snake and decided to make a script that would play out the perfect game, even if it took a little while to rack up the points. If anything I'd learn a few little new skills and be able to confuse a friend with my impossible high scores.

After a quick Google I had learnt about and downloaded AutoHotKey (www.autohotkey.com), it seemed to promise what I would need and maybe after this I could use it for anything similar that might ever come up.

Armed with the help file that comes with the program I started on a very limited version of the script that used hard-coded time interval values to trigger the turns which proved to be useless because the slightest lag or activity on my computer made these totally inaccurate. A little disheartened I had a quick look though the documentation before giving up on the puzzle and stumbled across a command to get the pixel colour of a given coordinate, maybe my friend would get his ass kicked after all.

So far the script doesn't work but it gets awfully close. Around half way through worming its way around the grid one of the coordinates I calculate to turn the snake at slips over into the wrong grid square and never fires. (at least I think this is my problem)

I have tried a few changes which are now commented out because they seemed to make things worse. Rather than give up I figured maybe there was at least one person on HN that might get a kick out of something small like this so I decided to share it with you. If anyone can get it to work then even better.

Since my usual webhost is down at the moment I zipped up my stuff (the macro, some images of the game, the game itself and an open office document with a grid and highlights on the squares that the snake should make its moves at) and uploaded it to the first free upload site I found, hope it doesn't cause any problems.

If no one wants to download a .zip file I can go back and upload them all separately for you.

http://www.wikiupload.com/download_page.php?id=198583 (the goods)





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: