There are several factors that could play in here... First of all is obviously some bad luck.
Secondly, you should know that the difficulty level only effects how the barbarians fight.
Next, are your units Veterans? Veteran units are units that have one at least one battle or were created in a town that has a barracks (ALWAYS BUILD BARRACKS. FIRST.)
Another possibility could be terrain. Your opponent may have cities that are on terrains such as hills that offer extra defense, but I doubt it...
Another possibility is bad execution on your part. When attacking a city or something else that is well defended using a unit like a knight or an armor (that has several movement points), only attack once per turn. Additional attacks suffer a penalty. It could be that your opponent is remembering this but you are not.
If none of these factors has contributed to it, then lets just look at the odds, shall we?
Your riflemen have a natural defense of 5. Fortified makes it 7. In city walls triples, so 21. If your opponent is attacking with an armor, that's an attack of 10. So the odds are 10:21, or about 2:1 against. That means 1 in 3 times, your opponent will be successful. The probability that he will win all 3 in a row is about 3.3%. So every once in a while, this could happen. Of course, if he has 2 armors, the odds are much better, at 6.5%. If it's happening repeatedly, though, it's either just bad luck or one of the factors I mentioned above.
The short answer is: No, the program does not get an edge in combat. Good luck with your game!
------------------
<IMG SRC="http://www.civfanatics.com/civ1/units/mbimg/militia.gif" border=0> <IMG SRC="http://www.civfanatics.com/civ1/units/mbimg/phalanx.gif" border=0>
Civilization I Master of masters