home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Fracas20867210102007.psc / Fracas_VB / ComputerAI.bas < prev   
BASIC Source File  |  2007-08-24  |  5KB  |  96 lines

  1. Attribute VB_Name = "ComputerAI"
  2. Option Explicit
  3. Option Base 1
  4.  
  5. Dim Score() As Single
  6. Dim BestScore As Single
  7. Dim BestCountry As Long
  8. Dim NumReinforce As Single
  9. Dim AttackDiff As Single
  10. Dim AttackedCountryThisTurn As Long
  11. Dim ToWhere As Long
  12. Dim XferAmount As Single
  13. Public MsgXferAmount As Long   'Public so we can see it for messages.
  14.  
  15. Dim Cntry As Long
  16. Dim Cntry2 As Long
  17.  
  18. 'These variables are used to calculate the number of troops to move.
  19. Dim AttProp As Single
  20. Dim AttSum1 As Single
  21. Dim AttSum2 As Single
  22. Dim A1 As Single
  23. Dim A2 As Single
  24. Dim A3 As Single
  25. Dim A4 As Single
  26. Dim A5 As Single
  27. Dim A6 As Single
  28. Dim B1 As Single
  29. Dim B2 As Single
  30. Dim B3 As Single
  31. Dim B4 As Single
  32. Dim B5 As Single
  33. Dim B6 As Single
  34. Dim D1 As Single
  35. Dim D2 As Single
  36.  
  37. 'Used for Custom AIs.
  38. Dim AIFile As String
  39. Dim CurrentLine As String
  40. Dim AIFileNumber As Long
  41.  
  42. 'Temporary registers used for a variety of purposes.
  43. Dim TempNum1 As Single
  44. Dim TempNum2 As Single
  45. Dim HQTemp As Single
  46.  
  47. 'The Hate array is used to keep track of, well, how much each computer
  48. 'hates each other player.
  49. 'For example:  a = Hate(x, y)
  50. 'a = the hate value, from 1 to 100.
  51. 'x = the player doing the hating.
  52. 'y = the player being hated.
  53. Public Hate(6, 6) As Integer
  54.  
  55. 'The following variables define the number of available computer
  56. 'personalities to pick from.
  57. Public Const NUMPERSONALITIES As Integer = 12
  58. Public PersonalityName(NUMPERSONALITIES) As String
  59.  
  60. 'These constants define the score for an impossible or unlikely move.
  61. Const NOTPOSSIBLE As Long = -999999   'Just a very low number.
  62. Const UNLIKELY As Long = 1            'Higher than NOTPOSSIBLE, but any other move is better.
  63.  
  64. 'These variables define the personality of the current AI.
  65. Dim SAMESCOREKEEPER         As Single               'Chance of keeping a country with the same bestscore.
  66. Dim HATEFACTOR              As Integer              'How badly this personality holds a grudge.
  67. Dim HQTROOPSMULTIPLIER      As Integer              'Number of times that the troops in a country count.
  68. Dim HQBODYOFWATER           As Integer              'Number of points a body of water is worth to HQ.
  69. Dim HQBORDERINGCOUNTRY      As Integer              'Number of points a bordering country is worth to HQ.
  70. Dim HQONEAWAYMULT           As Single               'Fraction of troops counted for countries 1 away from HQ.
  71. Dim HQTWOAWAYMULT           As Single               'Fraction of troops counted for countries 2 away from HQ.
  72. Dim HQNEXTTOENEMYHQ         As Single               'Score for putting HQ near enemy HQs.
  73. Dim HQNEARCENTERMULT        As Single               'Factor for HQ being closer to the center of the map.
  74. Dim HQDEFENDPROPENSITY      As Integer              'Points per strength difference to defend HQ.
  75. Dim REDEFLOSINGPROPOSITION  As Integer              'Factor for reinforcing defensive troops in a losing battle.
  76. Dim REDEFWINNINGPROPOSITION As Integer              'Factor for reinforcing defensive troops in a winning battle.
  77. Dim REATTLOSINGPROPOSITION  As Integer              'Factor for reinforcing offensive troops in a losing battle.
  78. Dim REATTWINNINGPROPOSITION As Integer              'Factor for reinforcing offensive troops in a winning battle.
  79. Dim REPUTPRESSUREONHQBASE   As Integer              'Score for reinforcing near an enemy HQ.
  80. Dim REPUTPRESSUREONHQMULT   As Integer              'Pro-rated Score for reinforcing near an enemy HQ.
  81. Dim REBETONASURETHING       As Integer              'Score for reinforcing a battle that can already be won.
  82. Dim ACANNEXTROOPS           As Single               'Factor for annexing a country with troops in it.
  83. Dim ACANNEXBASE             As Single               'Score for just annexing any piece of land. (* CFGBonusTroops)
  84. Dim ACANNEXNEARENEMYMULT    As Single               'Multiplier for taking free troops near enemy.
  85. Dim ACANNEXNEXTTOHQ         As Single               'Score for annexing unclaimed land next to an enemy HQ.
  86. Dim ACANNEXTWOAWAYMULT      As Single               'Fraction that free troops two countries away are worth.
  87. Dim ACPORTBASE              As Integer              'Score for just building a port.            (* CFGShips)
  88. Dim ACPORTTROOPS            As Integer              'Factor for building a port on a country with troops.
  89. Dim ACATTACKBASE            As Integer              'Score for simply attacking another defending player.
  90. Dim ACATTACKFACTOR          As Integer              'Pro-rated score for attacking another defending player.
  91. Dim ACBULLYBASE             As Integer              'Score for beating up a player in an easy battle.
  92. Dim ACBULLYFACTOR           As Integer              'Pro-rated score for attacking in an easy battle.
  93. Dim ACCLEANUPEMPTYS         As Integer              'Score for attacking an empty enemy country.
  94. Dim ACATTACKENEMYHQ         As Integer              'Score for being able to attack enemy HQ.
  95. Dim ACHATEATTACKED          As Integer              'How much more I hate you for attacking me.
  96. Dim ACHATE2