Programming AI isn't all that hard. It's designing an AI where the difficulty comes in. You have to decide what you want the AI to think about, and in what order, with which preferences, et cetera. It's a lot of abstracting complex phenomena into simple considerations.
To that end, it's not much different from programming anything else in the game. Like making a character move and jump involves a lot of different parts (input polling, velocity tracking, effects of gravity, collision detection, triggering and running animation systems, et cetera) and putting all those systems together. The difference is that most of those systems are quite visible and obvious, whereas an AI is much more cerebral.
But it's fun to do and figure out.