In the past I've had a side project involving automating casino games for fun. I followed this tutorial for automating simple web games with Python:
This tutorial uses Python Image Library (PIL) for 'reading' the UI and PyWin to manipulate the mouse in order to play the game. I would suggest using AutoPy instead of PyWin to give platform-agnostic GUI manipulation:
Cool project overall though, nice AI example.
As an aside, I find the whole area of bots automating repetitive human tasks fascinating, here's an excellent book about this topic (did you know a guy wrote a Lisp program that can compose orchestras in the style of Bach and fool human critics?):
Get dozens of book recommendations delivered straight to your inbox every Thursday.