How to make tetris bot made with auto it

I am venturing on programming Tetris game. I need help on how tetris bot made with auto it. I need to know how to make a bot that knows where the blocks are located and to identify the movements of the blocks. Can anybody shed some light for Me?
