Yes, but you won't be able to research the supply and demand as quickly under Fundies...
Announcement
Collapse
No announcement yet.
Supply and Demand Calculator v2 beta
Collapse
X
-
Originally posted by StuporMan
Monk,
I do not have classes this semester, so I will have some time to squeeze this little project in whilst working on my graduate project and at work.
StuporMan
Just a thought,
Monkso long and thanks for all the fish
Comment
-
Straybow,
That is a good point, I guess I will have to rely on caravans to get the needed research.
Monk,
We shall see about the demogame. I might play a new turnset just to see if I can get interest to return.
StuporManMan had always assumed that he was more intelligent than dolphins because he had achieved so much - the wheel, New York, wars and so on - whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man - for precisely the same reasons.
StuporMan's Supply and Demand Calculator
Supply and Demand Calculator 2.0.1 Beta Now loading savegames!
Comment
-
StupporMan,
As to your error, which version of a .sav file are you using? Currently I have only tested a 2.42 file.
I supposed you started with the samson's formulas... Maybe you should publish the formulas you are using so that others can help in your research?Civ2 "Great Library Index": direct download, Apolyton attachment
Comment
-
SlowThinker,
A save file would be immensely helpful, thank you.
Yes, I did start with samson's formulas. I could post the source that I am using, but that would be quite large. I could post pseudocode of the formulas, but that would take some time. I will work on getting the pseudocode (or source if I start running out of time) of just the supply and demand formulas. I definitely appreciate the help in getting all of these formulas working properly!
StuporMan
Edit: Here is the code for some of the special functions, supply and demand code to follow in subsequent posts. The source has been edited for readability.
Let me know if you need any clarification.
StuporMan
Note: \ is the integer division symbol in VB6, also _ allows a line of code to extend to the next line.
Code:Special Functions: Private Function DistanceToDateLine() As Integer If ((numHor(Map)) - 1) \ 2 - (numHor(City)) > 0 Then DistanceToDateLine = (numHor(City)) Else DistanceToDateLine = (numHor(Map)) - (numHor(City)) End If End Function Private Function DistanceToPole() As Integer If (numVer(City)) > ((numVer(Map)) \ 2) Then DistanceToPole = (numVer(Map)) - (numVer(City)) Else DistanceToPole = (numVer(City)) End If End Function Private Function DistanceToEquator() As Integer If numVer(Map) Mod 2 = 0 Then DistanceToEquator = Abs(((numVer(Map)) \ 2) - (numVer(City))) Else DistanceToEquator = Abs((numVer(Map)) \ 2 - (numVer(City))) End If End Function Private Function DistanceToMeanMeridian() As Integer DistanceToMeanMeridian = Abs((numHor(City)) - (((numHor(Map)) - 1) \ 2)) End Function Private Function LongitudeEast() As Integer LongitudeEast = (numHor(City)) - (((numHor(Map)) - 1) \ 2) If LongitudeEast < 0 Then LongitudeEast = 0 End If End Function Private Function LongitudeWest() As Integer LongitudeWest = -LongitudeEast End Function Private Function PolarCircle() As Integer PolarCircle = 0 If (numVer(City)) < ((numVer(Map))) \ 6 Or (numVer(City)) > ((numVer(Map))) * 5 \ 6 Then PolarCircle = 1 End If End Function Private Function TemperateZoneOffset() As Integer Dim iTemp1 As Integer Dim iTemp2 As Integer iTemp1 = Abs(((numVer(Map))) * 3 \ 4 - (numVer(City))) iTemp2 = Abs(((numVer(Map))) \ 4 - (numVer(City))) If (iTemp1 < iTemp2) Then TemperateZoneOffset = iTemp1 Else TemperateZoneOffset = iTemp2 End If End Function
Last edited by StuporMan; May 12, 2006, 10:10.Man had always assumed that he was more intelligent than dolphins because he had achieved so much - the wheel, New York, wars and so on - whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man - for precisely the same reasons.
StuporMan's Supply and Demand Calculator
Supply and Demand Calculator 2.0.1 Beta Now loading savegames!
Comment
-
Code:Beads: Supply(Beads) = (numTile(Ocean) + City(CurCity).hidTerrain(Ocean)) * 8 - _ DistanceToEquator Demand(Beads) = (21 - (numTile(Ocean) + City(CurCity).hidTerrain(Ocean))) * (1.5) _ + DistanceToEquator If (numTechs) + Civ(CurCiv).hidNumTechs > 32 Then Supply(Beads) = Supply(Beads) \ 2 End If If numTechs + Civ(CurCiv).hidNumTechs > 47 Then Demand(Beads) = Demand(Beads) \ 2 End If Select Case (numCitySize + City(CurCity).hidCitySize) Case Is < 4 Demand(Beads) = Demand(Beads) * (1.5) Case 10, 11, 12 Supply(Beads) = Supply(Beads) \ 2 Case Is > 12 Supply(Beads) = Supply(Beads) \ 2 Demand(Beads) = Demand(Beads) \ 2 End Select Cloth: Supply(Cloth) = (numTile(Desert) + City(CurCity).hidTerrain(Desert)) + _ (numTile(Plains) + City(CurCity).hidTerrain(Plains)) * 3 - _ (numRiver + City(CurCity).hidRivers) Demand(Cloth) = (numTile(Forest) + City(CurCity).hidTerrain(Forest)) * 4 + _ (numTile(hills) + City(CurCity).hidTerrain(hills)) * 4 Demand(Cloth) = Demand(Cloth) + (((numTechs + Civ(CurCiv).hidNumTechs) \ 10) * _ ((numTile(Forest) + City(CurCity).hidTerrain(Forest)) + _ (numTile(Mountains) + City(CurCity).hidTerrain(Mountains)) * 2 + _ (numTile(Tundra) + City(CurCity).hidTerrain(Tundra)) * 5 + _ (numTile(Glacier) + City(CurCity).hidTerrain(Glacier)) * 5 + _ DistanceToEquator * (1.5))) / 8 Select Case (numTechs) + Civ(CurCiv).hidNumTechs Case Is < 8 Supply(Cloth) = Supply(Cloth) \ 4 Case Is < 16 Supply(Cloth) = Supply(Cloth) \ 2 Case Is > 19 Supply(Cloth) = Supply(Cloth) * 2 End Select If chkTech(Industrialization).Value Or _ Civ(CurCiv).hidTechs(Industrialization) Then Supply(Cloth) = Supply(Cloth) * (1.5) End If Coal: Supply(Coal) = ((numTile(Plains) + City(CurCity).hidTerrain(Plains)) + _ (numTile(Forest) + City(CurCity).hidTerrain(Forest)) + _ (numTile(Swamp) + City(CurCity).hidTerrain(Swamp)) + _ (numTile(Jungle) + City(CurCity).hidTerrain(Jungle) + 1)) * _ ((numTile(hills) + City(CurCity).hidTerrain(hills)) * 5) Demand(Coal) = (DistanceToEquator + 10) * _ (((numCitySize + City(CurCity).hidCitySize) + 2) \ 5) + _ (numTechs + Civ(CurCiv).hidNumTechs) If (numTechs) < 20 Then Supply(Coal) = Supply(Coal) \ 2 End If Select Case (numCitySize + City(CurCity).hidCitySize) Case Is < 5 Demand(Coal) = 0 Supply(Coal) = Supply(Coal) \ 2 Case Is < 8 Supply(Coal) = Supply(Coal) \ 2 Demand(Coal) = Demand(Coal) \ 2 Case Is > 17 Supply(Coal) = Supply(Coal) * 2 End Select If chkImp(PowerPlant) Or City(CurCity).hidImpr(PowerPlant) Then Demand(Coal) = Demand(Coal) * 2 ElseIf chkImp(NuclearPlant).Value Or chkImp(HydroPlant).Value Or _ chkImp(SolarPlant).Value Or _ City(CurCity).hidImpr(NuclearPlant) Or _ City(CurCity).hidImpr(HydroPlant) Or _ City(CurCity).hidImpr(SolarPlant) Then Demand(Coal) = Demand(Coal) \ 8 End If If chkTech(Industrialization).Value Or _ Civ(CurCiv).hidTechs(Industrialization) Then Demand(Coal) = Demand(Coal) * 2 End If If chkTech(Electricity).Value Or _ Civ(CurCiv).hidTechs(Electricity) Then Demand(Coal) = Demand(Coal) * 2 End If Copper: Supply(Copper) = (numTile(hills) + City(CurCity).hidTerrain(hills)) * 5 + _ (numTile(Mountains) + City(CurCity).hidTerrain(Mountains)) * 5 Demand(Copper) = (numRiver + City(CurCity).hidRivers) + _ (numRoads + City(CurCity).hidRoads) + CurCity + 1 If (numCont) Mod 2 = 0 Then Supply(Copper) = Supply(Copper) * 2 End If Select Case (numCitySize + City(CurCity).hidCitySize) Case Is < 3 Demand(Copper) = 0 Case Is < 5 Demand(Copper) = Demand(Copper) \ 2 Case Else Demand(Copper) = Demand(Copper) * ((numCitySize) - 3) \ 5 End Select If chkTech(Electricity).Value Or _ Civ(CurCiv).hidTechs(Electricity) Then Demand(Copper) = Demand(Copper) * (1.5) End If If chkTech(Computers).Value Or _ Civ(CurCiv).hidTechs(Computers) Then Demand(Copper) = Demand(Copper) \ 4 End If If chkImp(MarketPlace).Value Or _ City(CurCity).hidImpr(MarketPlace) Then Demand(Copper) = Demand(Copper) * (1.5) End If If chkImp(Bank).Value Or _ City(CurCity).hidImpr(Bank) Then Demand(Copper) = Demand(Copper) * (1.5) End If Dye: Supply(Dye) = (numTile(Grassland) + City(CurCity).hidTerrain(Grassland)) * 10 + _ (numRiver + City(CurCity).hidRivers) * 2 - _ ((numTile(Plains) + City(CurCity).hidTerrain(Plains)) * 2) Demand(Dye) = Supply(Cloth) + (numRoads + City(CurCity).hidRoads) If (numCont) Mod 4 = 0 Then Supply(Dye) = Supply(Dye) * 2 End If If chkTech(Chemistry).Value Or _ Civ(CurCiv).hidTechs(Chemistry) Then Demand(Dye) = Demand(Dye) \ 2 End If If chkTech(MassProduction).Value Or _ Civ(CurCiv).hidTechs(MassProduction) Then Demand(Dye) = Demand(Dye) \ 2 End If Gems: Supply(Gems) = ((numTile(Desert) + City(CurCity).hidTerrain(Desert)) + 1) * _ ((numTile(Mountains) + City(CurCity).hidTerrain(Mountains)) + 1) * _ ((numTile(Swamp) + City(CurCity).hidTerrain(Swamp)) + 1) + _ (numTile(Plains) + City(CurCity).hidTerrain(Plains)) If (numCont) = 7 Then Supply(Gems) = Supply(Gems) * (1.5) End If Select Case (numCitySize + City(CurCity).hidCitySize) Case Is < 8 Supply(Gems) = Supply(Gems) \ 2 Case 13, 14, 15, 16, 17 Supply(Gems) = Supply(Gems) * (1.5) Case Is > 17 Supply(Gems) = Supply(Gems) * 2 End Select Demand(Gems) = (numCitySize + City(CurCity).hidCitySize) * 8 If ((numHor(City)) + (numVer(City))) Mod 3 = 1 Then If chkTech(Chemistry) Or Civ(CurCiv).hidTechs(Chemistry) Then Demand(Gems) = Demand(Gems) * (1.5) End If If chkTech(Economics) Or Civ(CurCiv).hidTechs(Economics) Then Demand(Gems) = Demand(Gems) \ 2 End If If chkTech(Computers) Or Civ(CurCiv).hidTechs(Computers) Then Demand(Gems) = Demand(Gems) \ 2 End IfGems If cboCiv.ListIndex = Spanish Then Demand(Gems) = Demand(Gems) * 2 End If If chkImp(Bank) Or City(CurCity).hidImpr(Bank) Then Demand(Gems) = Demand(Gems) * (1.5) End If If chkImp(Cathedral) Or City(CurCity).hidImpr(Cathedral) Then Demand(Gems) = Demand(Gems) * (1.5) End If Else ' Demand(Gems) = -999 End If Gold: Supply(Gold) = ((numTile(Mountains) + City(CurCity).hidTerrain(Mountains)) * 2 + _ (numTile(hills) + City(CurCity).hidTerrain(hills)) + 2) * _ ((numRiver + City(CurCity).hidRivers) + 2) If (numTile(Mountains) + City(CurCity).hidTerrain(Mountains)) < 3 Then Supply(Gold) = Supply(Gold) \ 2 End If Select Case (numCitySize + City(CurCity).hidCitySize) Case Is > 9 Supply(Gold) = Supply(Gold) * 4 Case Is > 4 Supply(Gold) = Supply(Gold) * 2 End Select Demand(Gold) = (numCitySize + City(CurCity).hidCitySize) * 8 If ((numHor(City)) + (numVer(City))) Mod 3 = 2 Then If chkTech(Chemistry) Or Civ(CurCiv).hidTechs(Chemistry) Then Demand(Gold) = Demand(Gold) * (1.5) End If If chkTech(Economics) Or Civ(CurCiv).hidTechs(Economics) Then Demand(Gold) = Demand(Gold) \ 2 End If If chkTech(Computers) Or Civ(CurCiv).hidTechs(Computers) Then Demand(Gold) = Demand(Gold) \ 2 End If If cboCiv.ListIndex = Spanish Then Demand(Gold) = Demand(Gold) * 2 End If If chkImp(Bank) Or City(CurCity).hidImpr(Bank) Then Demand(Gold) = Demand(Gold) * (1.5) End If If chkImp(Cathedral) Or City(CurCity).hidImpr(Cathedral) Then Demand(Gold) = Demand(Gold) * (1.5) End If Else ' Demand(Gold) = -999 End If Hides: Supply(Hides) = (numTile(Forest) + City(CurCity).hidTerrain(Forest)) * 4 + _ (numTile(Tundra) + City(CurCity).hidTerrain(Tundra)) * 6 + _ (numTile(Glacier) + City(CurCity).hidTerrain(Glacier)) * 6 + _ (numTile(Jungle) + City(CurCity).hidTerrain(Jungle)) * 3 + _ (numRiver + City(CurCity).hidRivers) * 3 Demand(Hides) = (numTile(Forest) + City(CurCity).hidTerrain(Forest)) + _ (numTile(Mountains) + City(CurCity).hidTerrain(Mountains)) * 2 _ + (numTile(Tundra) + City(CurCity).hidTerrain(Tundra)) * 5 + _ (numTile(Glacier) + City(CurCity).hidTerrain(Glacier)) * 5 + _ DistanceToEquator * (1.5) Select Case (numTechs + Civ(CurCiv).hidNumTechs) Case Is < 10 Demand(Hides) = Demand(Hides) * 4 Case Is < 20 Demand(Hides) = Demand(Hides) * 2 Case Is > 47 Demand(Hides) = Demand(Hides) \ 2 End Select Select Case (numCitySize + City(CurCity).hidCitySize) Case Is < 3 And (numTechs + Civ(CurCiv).hidNumTechs) < 48 And _ Not (chkTech(Industrialization) Or _ Civ(CurCiv).hidTechs(Industrialization)) If (numTechs + Civ(CurCiv).hidNumTechs) < 22 Then Supply(Hides) = Supply(Hides) * 2 End If Demand(Hides) = Demand(Hides) * 2 Case Is > 7 Supply(Hides) = Supply(Hides) / 2 End Select Select Case (numTechs + Civ(CurCiv).hidNumTechs) Case Is < 16 Supply(Hides) = Supply(Hides) * 4 Case Is < 24 Supply(Hides) = Supply(Hides) * 2 Case Is > 47 Supply(Hides) = Supply(Hides) \ 2 End Select If chkTech(Industrialization) Or _ Civ(CurCiv).hidTechs(Industrialization) Then Demand(Hides) = Demand(Hides) \ 3 End If If chkTech(MassProduction) Or Civ(CurCiv).hidTechs(MassProduction) Then Demand(Hides) = 0 End If
Last edited by StuporMan; May 12, 2006, 12:54.Man had always assumed that he was more intelligent than dolphins because he had achieved so much - the wheel, New York, wars and so on - whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man - for precisely the same reasons.
StuporMan's Supply and Demand Calculator
Supply and Demand Calculator 2.0.1 Beta Now loading savegames!
Comment
-
Code:Oil: Supply(Oil) = (numTile(Desert) + City(CurCity).hidTerrain(Desert)) * 10 + _ (numTile(Tundra) + City(CurCity).hidTerrain(Tundra)) * 8 _ + (numTile(Glacier) + City(CurCity).hidTerrain(Glacier)) * 8 + _ (numTile(Swamp) + City(CurCity).hidTerrain(Swamp)) * 6 If (numCont) = 9 Then Supply(Oil) = Supply(Oil) * (1.5) End If If (numCitySize + City(CurCity).hidCitySize) > 37 Then Supply(Oil) = Supply(Oil) * 2 End If Demand(Oil) = ((numTechs) + Civ(CurCiv).hidNumTechs) \ 6 Select Case (numCitySize + City(CurCity).hidCitySize) Case Is < 3 Demand(Oil) = Demand(Oil) \ 2 Case Is < 5 Demand(Oil) = Demand(Oil) * (0.75) Case Is < 8 Demand(Oil) = Demand(Oil) * (1.5) Case Is < 10 Demand(Oil) = Demand(Oil) * 2 Case Is < 13 Demand(Oil) = Demand(Oil) * 4 Case Is < 18 Demand(Oil) = Demand(Oil) * 5 Case Is < 20 Demand(Oil) = Demand(Oil) * 6 Case Is < 23 Demand(Oil) = Demand(Oil) * 12 Case Is < 28 Demand(Oil) = Demand(Oil) * 14 Case Is < 33 Demand(Oil) = Demand(Oil) * 16 Case Is < 38 Demand(Oil) = Demand(Oil) * 18 Case Else Demand(Oil) = Demand(Oil) * 20 End Select If Not discCombustion() Then Supply(Oil) = Supply(Oil) \ 8 End If If chkTech(Automobile) Or Civ(CurCiv).hidTechs(Automobile) Then Demand(Oil) = Demand(Oil) * 3 End If If chkTech(Industrialization) = 0 And _ Not Civ(CurCiv).hidTechs(Industrialization) Then Demand(Oil) = -999 End If If chkImp(Factory) Or City(CurCity).hidImpr(Factory) Then Demand(Oil) = Demand(Oil) * (1.5) End If If chkImp(SuperHighways) Or City(CurCity).hidImpr(SuperHighways) Then Demand(Oil) = Demand(Oil) * 2 End If If chkImp(MassTransit) Or City(CurCity).hidImpr(MassTransit) Then Demand(Oil) = Demand(Oil) \ 2 End If If chkImp(RecyclingCenter) Or City(CurCity).hidImpr(RecyclingCenter) Then Demand(Oil) = Demand(Oil) \ 2 End If Salt: Supply(Salt) = (numTile(Desert) + City(CurCity).hidTerrain(Desert)) * 4 + _ (numTile(Swamp) + City(CurCity).hidTerrain(Swamp)) * 2 + _ (numTile(Ocean) + City(CurCity).hidTerrain(Ocean)) * 3 - _ (numTechs + Civ(CurCiv).hidNumTechs) \ 6 If (numCont) = 1 Or (numCont) = 3 Or (numCont) = 5 Then Supply(Salt) = Supply(Salt) * (1.5) End If Select Case (numCitySize + City(CurCity).hidCitySize) Case Is < 6 Demand(Salt) = (numCitySize + City(CurCity).hidCitySize) * 8 Case Is < 11 Demand(Salt) = 40 + ((numCitySize + City(CurCity).hidCitySize) - 5) * 4 Case Is < 16 Demand(Salt) = 60 + ((numCitySize + City(CurCity).hidCitySize) - 10) * 2 Case Is < 20 Demand(Salt) = 70 + ((numCitySize + City(CurCity).hidCitySize) - 15) Case Else Demand(Salt) = 75 End Select Demand(Salt) = Demand(Salt) - (numTechs + Civ(CurCiv).hidNumTechs) \ 2 If chkTech(Pottery) = 0 And Not Civ(CurCiv).hidTechs(Pottery) Then Supply(Salt) = Supply(Salt) \ 3 End If If chkImp(Aqueduct) Or City(CurCity).hidImpr(Aqueduct) Then Supply(Salt) = Supply(Salt) * (1.5) End If Silk: Supply(Silk) = ((numTile(Forest) + City(CurCity).hidTerrain(Forest)) * 2 + _ (numTile(Jungle) + City(CurCity).hidTerrain(Jungle)) + 1) * _ ((numTile(hills) + City(CurCity).hidTerrain(hills)) + 1) _ + (LongitudeEast * 2) If cboCiv.ListIndex = Chinese Then Supply(Silk) = Supply(Silk) * 2 End If If (numCont) Mod 5 = 0 Then Supply(Silk) = Supply(Silk) * 2 End If Demand(Silk) = (numTile(Desert) + City(CurCity).hidTerrain(Desert)) * 4 + _ (numTile(Plains) + City(CurCity).hidTerrain(Plains)) \ 2 _ + (numTile(Swamp) + City(CurCity).hidTerrain(Swamp)) * 2 + _ (numTile(Jungle) + City(CurCity).hidTerrain(Jungle)) * 4 _ + DistanceToPole * 2 + DistanceToDateLine If (numCont) = 1 And ((numCity) \ 2) Mod 2 = 1 Then Demand(Silk) = Demand(Silk) * (1.5) End If Select Case (numCitySize + City(CurCity).hidCitySize) Case Is < 3 Demand(Silk) = Demand(Silk) \ 4 Case Is < 7 Demand(Silk) = Demand(Silk) \ 2 Case Is > 7 Demand(Silk) = Demand(Silk) * 2 End Select Silver: Supply(Silver) = (numTile(Mountains) + City(CurCity).hidTerrain(Mountains)) * 8 + _ (numTile(hills) + City(CurCity).hidTerrain(hills)) If Supply(Silver) > 0 Then Supply(Silver) = Supply(Silver) + DistanceToMeanMeridian End If If (numCont) > 8 Then Supply(Silver) = Supply(Silver) * (1.5) End If If chkTech(IronWorking) = 0 And Not Civ(CurCiv).hidTechs(IronWorking) Then Supply(Silver) = Supply(Silver) \ 2 End If If (numCitySize + City(CurCity).hidCitySize) < 5 Then Supply(Silver) = Supply(Silver) \ 2 End If Demand(Silver) = (numCitySize + City(CurCity).hidCitySize) * 8 If ((numHor(City)) + (numVer(City))) Mod 3 = 0 Then If chkTech(Chemistry) Or Civ(CurCiv).hidTechs(Chemistry) Then Demand(Silver) = Demand(Silver) * (1.5) End If If chkTech(Economics) Or Civ(CurCiv).hidTechs(Economics) Then Demand(Silver) = Demand(Silver) \ 2 End If If chkTech(Computers) Or Civ(CurCiv).hidTechs(Computers) Then Demand(Silver) = Demand(Silver) \ 2 End If If cboCiv.ListIndex = Spanish Then Demand(Silver) = Demand(Silver) * 2 End If If chkImp(Bank) Or City(CurCity).hidImpr(Bank) Then Demand(Silver) = Demand(Silver) * (1.5) End If If chkImp(Cathedral) Or City(CurCity).hidImpr(Cathedral) Then Demand(Silver) = Demand(Silver) * (1.5) End If End If Spice: Supply(Spice) = ((numTile(Desert) + City(CurCity).hidTerrain(Desert)) + _ (numTile(Swamp) + City(CurCity).hidTerrain(Swamp)) + _ ((numTile(Jungle) + City(CurCity).hidTerrain(Jungle)) * (1.5))) * _ ((numTile(Ocean) + City(CurCity).hidTerrain(Ocean)) + _ (numRiver + City(CurCity).hidRivers)) If DistanceToEquator < 10 Then Supply(Spice) = Supply(Spice) * 2 End If Supply(Spice) = Supply(Spice) - DistanceToEquator If (numCont) = 1 Then Supply(Spice) = Supply(Spice) \ 2 End If If (numContSize + mHidCont(numCont)) < 26 Then Supply(Spice) = Supply(Spice) * 2 ElseIf (numContSize + mHidCont(numCont)) > 300 Then Supply(Spice) = Supply(Spice) \ 2 End If Demand(Spice) = (numContSize + mHidCont(numCont)) \ 10 Select Case (numCitySize + City(CurCity).hidCitySize) Case Is < 4 Demand(Spice) = Demand(Spice) \ 2 Case Is > 7 Demand(Spice) = Demand(Spice) * 2 End Select If (numContSize + mHidCont(numCont)) > 400 And _ (((numHor(City)) + (numVer(City))) \ 2) Mod 2 = 0 Then Demand(Spice) = 0 End If If chkTech(Refrigeration) Or Civ(CurCiv).hidTechs(Refrigeration) Then Demand(Spice) = Demand(Spice) \ 2 End If Uranium: Supply(Uranium) = ((numTile(Desert) + City(CurCity).hidTerrain(Desert)) + _ (numTile(Tundra) + City(CurCity).hidTerrain(Tundra)) + _ (numTile(Glacier) + City(CurCity).hidTerrain(Glacier))) * _ ((numTile(Mountains) + City(CurCity).hidTerrain(Mountains)) + 1) * _ ((numTile(hills) + City(CurCity).hidTerrain(hills)) + _ (numRiver + City(CurCity).hidRivers) + 1) Demand(Uranium) = (numTechs + Civ(CurCiv).hidNumTechs) ^ 2 Select Case (numCitySize + City(CurCity).hidCitySize) Case Is < 3 Demand(Uranium) = Demand(Uranium) \ 8 Supply(Uranium) = 0 Case Is < 8 Supply(Uranium) = Supply(Uranium) \ 6 Demand(Uranium) = Demand(Uranium) \ 4 Case Is < 13 Supply(Uranium) = Supply(Uranium) \ 3 Demand(Uranium) = Demand(Uranium) \ 2 Case Is < 18 Supply(Uranium) = Supply(Uranium) \ 2 Case Is < 23 Supply(Uranium) = Supply(Uranium) * 2 \ 3 Case Is < 28 Supply(Uranium) = Supply(Uranium) * 5 \ 6 End Select If chkTech(NuclearFission).Value = 0 And _ Civ(CurCiv).hidTechs(NuclearFission) = False Then Demand(Uranium) = -999 Supply(Uranium) = -999 End If If chkImp(NuclearPlant) Or City(CurCity).hidImpr(NuclearPlant) Then Demand(Uranium) = Demand(Uranium) * 2 End If If chkImp(SDI) Or City(CurCity).hidImpr(SDI) Then Demand(Uranium) = Demand(Uranium) * 2 End If Wine: If (numTile(Plains) + City(CurCity).hidTerrain(Plains)) * 4 < _ (numRiver + City(CurCity).hidRivers) * 5 - _ (numTile(Grassland) + City(CurCity).hidTerrain(Grassland)) Then Supply(Wine) = (numTile(Plains) + City(CurCity).hidTerrain(Plains)) * 4 Else Supply(Wine) = (numRiver + City(CurCity).hidRivers) * 5 - _ (numTile(Grassland) + City(CurCity).hidTerrain(Grassland)) End If Supply(Wine) = Supply(Wine) + DistanceToDateLine \ 4 Select Case (numCitySize + City(CurCity).hidCitySize) Case Is < 3 Supply(Wine) = Supply(Wine) \ 2 Case 8, 9, 10 Supply(Wine) = Supply(Wine) * 2 End Select If (numVer(City)) < ((numVer(Map)) - 1) \ 2 Then Supply(Wine) = Supply(Wine) * 2 End If If (numCont) Mod 4 = 2 Then Supply(Wine) = Supply(Wine) * (1.5) End If If cboCiv.ListIndex = French Then Supply(Wine) = Supply(Wine) * 2 End If Demand(Wine) = Abs((numHor(City)) - (numVer(City))) + _ (((numCitySize + City(CurCity).hidCitySize) + 7) \ 5) * 4 Wool: Supply(Wool) = ((numTile(Grassland) + City(CurCity).hidTerrain(Grassland)) + _ (numTile(hills) + City(CurCity).hidTerrain(hills)) * 2 + _ ((numRiver + City(CurCity).hidRivers) \ 2)) * _ ((numTile(Tundra) + City(CurCity).hidTerrain(Tundra)) + _ (numTile(Glacier) + City(CurCity).hidTerrain(Glacier)) + _ 2 + PolarCircle) Demand(Wool) = ((numTile(Plains) + City(CurCity).hidTerrain(Plains)) * 2 + _ (numTile(Forest) + City(CurCity).hidTerrain(Forest))) + _ (TemperateZoneOffset * 2) If chkTech(Industrialization) Or Civ(CurCiv).hidTechs(Industrialization) Then Demand(Wool) = Demand(Wool) * 2 End If
Last edited by StuporMan; May 12, 2006, 12:56.Man had always assumed that he was more intelligent than dolphins because he had achieved so much - the wheel, New York, wars and so on - whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man - for precisely the same reasons.
StuporMan's Supply and Demand Calculator
Supply and Demand Calculator 2.0.1 Beta Now loading savegames!
Comment
-
StupporMan,
Civ2 classic always works, FW and MGE always fails ('error'd') after I try to open a savefile.
Maybe you didn't count with the different structure of savefiles of FW and MGE.
If you want I have constants (sizes of blocks etc.) of all three save formats (except ToT).
Attached files:
I started a new 2.42 game, saved it, then started MGE, loaded the 2.42 save and saved in MGE format.
Pseudocode - do you mean a code that is easily readable by a human and you need to write a compiler that transfers it in the VB6 code?Attached FilesCiv2 "Great Library Index": direct download, Apolyton attachment
Comment
-
Slowthinker,
By pseudocode I mean code that is more generalized than compiler-ready code. It generally ends up being easier to read and understand than regular compiler specific code, simply because it should not require any compiler specific knowledge. The code that I have presented is a kind of hybrid. I attempted to make a few small changes to make the code more readable (IE I took out some compiler specific functions that I need to make things work) but the code has not been modified enough to be considered pseudocode. Let me know if I need to format it to make it more readable.
As to the FW, MGE, and TOT files always erroring. I am sure I just did not get to testing these file types yet. I know that this is still a alpha or beta quality level program. The interface is nearly finished, but not all features are in place and working yet. I believe that I stopped working on getting the other civ version formats working until I could fix the supply and demand calculations to be more accurate. Unfortunately, grad school made sure I was unable to work on this project for a number of months and my memory is a little fuzzy on these things.
I will have a look and try and find out why the error message is occuring and maybe make my error messages a touch more descriptive.
StuporMan
edit:
I went ahead and reformated the code to make the page not quite so broken.Last edited by StuporMan; May 12, 2006, 12:58.Man had always assumed that he was more intelligent than dolphins because he had achieved so much - the wheel, New York, wars and so on - whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man - for precisely the same reasons.
StuporMan's Supply and Demand Calculator
Supply and Demand Calculator 2.0.1 Beta Now loading savegames!
Comment
-
Originally posted by StuporMan
Slowthinker,
By pseudocode I mean code that is more generalized than compiler-ready code ....Let me know if I need to format it to make it more readable.
I went ahead and reformated the code to make the page not quite so broken.
Maybe you could just put the code in a file and attach it.
Originally posted by StuporMan
As to the FW, MGE, and TOT files always erroring. I am sure I just did not get to testing these file types yet. I know that this is still a alpha or beta quality level program. The interface is nearly finished, but not all features are in place and working yet. I believe that I stopped working on getting the other civ version formats working until I could fix the supply and demand calculations to be more accurate.Civ2 "Great Library Index": direct download, Apolyton attachment
Comment
-
I got an idea - maybe you could put the pseudocode in the program with editable constants...
It would be useful for testing.Civ2 "Great Library Index": direct download, Apolyton attachment
Comment
-
Slowthinker,
Are you wanting the pseudocode for the entire program or is what I provided above sufficient. I could post the source for the entire application if you wish.
As to the constants for the different file types:
I have already done almost exactly what you said already in the code. I did that in my first iteration through. The problem lies in the fact that if I am off by >= 1 byte it can cause an error, so debugging takes a while to get them right. What made me stop working on the MGE etc file loading was not difficulty in finding the constants (I have a file that lists those nicely), the issue was the supply and demand calculations coming out all wrong with the 2.42 loading. I figured I should make the calculator useful for something first, before I went and added features to allow more people access to inaccurate data.
(In other words, my thought was make a small user set happy instead of releasing a very buggy program to the masses. A good many software companies have gone under from not understanding this principle.)
Unfortunately I am out of town for the weekend to visit the matrons-in-law on their very special day. I will enjoy their company, but it will seriously inhibit my ability to code/debug this weekend.
Well, I just had a thought. I will go ahead and post the source here. That will solve my backup woes, and will allow the community to assist my coding endeavors. However, I must insist that no one post an executable from this source, distribute this source or modification thereof, here or elsewhere, unless they first get permission from myself and give me the proper credit. Since my name (or pseudonym) is attached to this thing, I do not want others doing bad things and wreaking havoc in the Civ community in my name. Second, I have spent many hours of research, coding, and debugging this application. It was a labor of love, but I do wish to receive what credit I am do for it.
Now, I will allow for comments and snippets to be posted here for revision and suggestion. I will do my best to be prompt in my consideration and in making the changes.
Sorry for the long spiel, I just need to protect myself a little bit before posting source code.
edit:
source code was downloaded 1 time. It will be released again once I add a GPL.
StuporManLast edited by StuporMan; May 14, 2006, 09:16.Man had always assumed that he was more intelligent than dolphins because he had achieved so much - the wheel, New York, wars and so on - whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man - for precisely the same reasons.
StuporMan's Supply and Demand Calculator
Supply and Demand Calculator 2.0.1 Beta Now loading savegames!
Comment
-
Originally posted by StuporMan
Originally posted by SlowThinker
I got an idea - maybe you could put the pseudocode in the program with editable constants...
It would be useful for testing.
I meant the Calculator would show a text of the pseudocode you posted here (formulas), but with editable constants. This could allow a comfortable testing and searching for the correct formula.
In other words, my thought was make a small user set happy instead of releasing a very buggy program to the masses. A good many software companies have gone under from not understanding this principle
I guess some constant is wrong, because Civ2Admin (my program) always worked well/badly with all versions.
I will try to look in the code if I have time.Civ2 "Great Library Index": direct download, Apolyton attachment
Comment
-
Comment
-
Boco,
I am glad to hear that there are interested lurkers in this project. I thought for a long time that only a couple of people were interested in this project and that ended up being very discouraging to the project as a whole. Now it appears that I was underestimating the interest in this project. I think I will change my tactic and get the program working for all versions of civ 2 that I can, and then get the supply/demand calculations working.
Slowthinker,
Ahh, I think I understand what you are saying now. I will look into putting a menu in the calculator to allow the editing of the constants.
Thanks for taking a look at my code. I appreciate the help. Let me apologize ahead of time for the messiness of the coding structure and lack of comments. I thought I would be the only one looking at it, so I did not make my usual effort to make the code programmer friendly. Hopefully, you will not find it too confusing.
Since I am assuming you are the one who downloaded the source code (and I trust you to not misuse the code) I will remove the source code download for the time being. Once I have time to give it the proper GPL treatment I will release it to the public once again.
StuporManMan had always assumed that he was more intelligent than dolphins because he had achieved so much - the wheel, New York, wars and so on - whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man - for precisely the same reasons.
StuporMan's Supply and Demand Calculator
Supply and Demand Calculator 2.0.1 Beta Now loading savegames!
Comment
Comment