Depends how in depth you want to get, but this article has some information: https://iseclab.org/papers/botdetection-article.pdf
Basically you keep track of data from every user and look at a few specific data points to see if any players differ heavily from the average user.
You could use anything to code the bot... autohotkey, python, java, etc. For a flash game you just need to move the mouse around and maybe collect pixel data.