fire-eggs / CivOne

An open source implementation of Sid Meier's Civilization 1 using C# and .NET.
Creative Commons Zero v1.0 Universal
20 stars 4 forks source link

AI Barbarian lands on land without any city and cant find the way it should move #161

Closed iegik closed 2 years ago

iegik commented 2 years ago
Screenshot 2021-10-09 at 16 04 02

https://github.com/fire-eggs/CivOne/blob/8d71b33d64f465ff42735c0332c86bccb4521ddd/src/AI.Barbarians.cs#L49-L50 Here, in the BarbarianMoveWater method AI tries find any city on the land to go forward, but fails on infinite loop (see #98)

axx0 commented 2 years ago

So nearestCity returns null? Also what is the function of for (int i = 0; i < 1000; i++)?

iegik commented 2 years ago

@axx0 Hmm, I'm not sure. I'll try debug next time.