Amen!Meaning that I suspect that there's more than a bit of a mess to be found in the code
I guess we can take that for granted... We can deduce that from the type of bugs the game still has today and from the "inconsistent" behavior that can be seen in many places... I'm pretty sure that even the same (or a very similar) algorithm is implemented twice (or even several times), if it is needed in two or more different places...
Example: buildings with certain prerequisites. Like ivory for Statue of Zeus, 3 Armies for Pentagon, 5 Stock Exchanges for Wall Street, etc.
Let's assume, you have started building such a project and then, before you were able to finish it, the prerequisite is lost. (Ivory got pillaged, a city with a Stock Exchange is captured by an enemy, etc.) What happens?
- The Wall Street project can not be completed, if the number of Stock Exchanges in your empire falls below 5.
- The SDI project can be completed, if the number of SAM Batteries in your empire falls below 5.
(See https://forums.civfanatics.com/threads/build-projects-with-prerequisites.533669/ )
Another "interesting" example is how airfields work... See https://forums.civfanatics.com/threads/airfield-sharing.430541/#post-13279284
Considering that messy code like this tends to be difficult to understand and still more difficult to extend (once we want to add new features), it may be even less effort to implement it from scratch but in a well-designed, well-modularized & extendable way?
On another topic: The community has already done a lot of reverse engineering of the game mechanics in the past 20 years. We know the .sav file format, the corruption model, AI attitude, war weariness, interturn mechanics, etc. A lot of that wisdom has been condensed into CivAssistII. And CivAssistII has been implemented in C#! Have you already asked Andrew Inwood, whether he would share the CivAssistII code with us?
Coincidentally just over the last Christmas break I toyed with the idea of asking him myself. I had to set up a new Windows 10 Laptop for my mother and thought it could not hurt to install Civ3 on it. Despite all the problems that many people reported with Windows 10, I got it running without any trouble using the usual no-disc executable.
Then I thought I would give Andrew's "new" version of CivAssistII a try. (He had recompiled it with an up-to-date .NET Framework in 2016, as the original version with .NET 1.1 did no longer work for many people.)
But the new version just did not work for me. It did not recognize automatically, when the game was started. When I tried to load a .sav file manually, it errored out immediately with some strange exception, even when trying a simple 4000 BC.sav saved freshly from a newly started C3C game. Loading a 4000 BC.sav from a PtW game worked ok, but it did not display the world map and some other things. (Apparently CivAssistII is no longer able to find the tile graphics.)
Similar things are also reported by many other people, so I thought I could try to debug into these problems and try to fix them. But then I decided against it and rather spent the time with the family... (After all, the original CivAssistII still works fine on my Windows 7 desktop...)