Yeah, I'm trying to program an A.I that can play Pac-Man. However, to do that I would need to access the variables that the game is using. How would I do that? I also need to program software that can emulate a USB controller and have that control the A.I's input. Is what I'm doing impossible?
A while ago, someone made an AI that learned to play Super Mario World.
https://www.youtube.com/watch?v=qv6UVOQ0F44Looks like he used the BizHawk emulator, which can be scripted using Lua. The scripting engine probably provides access to the internal "RAM" of the emulated system, so you can get values for sprite positions and return controller inputs.
Emulators with Lua scripting allow you to read and write to RAM. You'll have to reverse engineer the game (or read someone else's notes on it) to know where the variables you need are and how to interpret them. You can also manipulate joypad input using Lua.
Okay, I can't find documentation on the NES version of Pac-Man, so I switched to Donkey Kong. However, is there a physics analysis anywhere on Donkey Kong?
My first NES project was a graphics hack of PacMan. I also changed the maze. I can tell you anything you want to know about PacMan.
But, I don't think this is the right project for you.
A better idea would be to reverse engineer PacMan as a learning experience, to learn NES development. Not that PacMan uses the best practices for NES programming, but it would be a start.