|
Britbot
|
00001 #region #Usings 00002 00003 using System; 00004 00005 #endregion 00006 00007 namespace Britbot 00008 { 00012 public class Score : IComparable, IComparable<Score> 00013 { 00014 #region Fields & Properies 00015 00019 public readonly double EnemyShips; 00020 00024 public readonly double Eta; 00025 00029 public int MinTurnsToEnemyCapture; 00030 00035 public int Density; 00036 00040 public ITarget Target; 00041 00045 public TargetType Type; 00046 00050 public double Value { get; private set; } 00051 00052 #endregion 00053 00054 #region Constructors & Initializers 00055 00064 public Score(ITarget target, TargetType type, double value, double EnemyShips, double eta, 00065 int MinTurnsToEnemyCapture, int Density) 00066 { 00067 this.Target = target; 00068 this.Type = type; 00069 this.Value = value; 00070 this.Eta = eta; 00071 this.EnemyShips = EnemyShips; 00072 this.MinTurnsToEnemyCapture = MinTurnsToEnemyCapture; 00073 this.Density = Density; 00074 } 00075 00076 #endregion 00077 00078 #region Interface Implementations 00079 00085 public int CompareTo(object obj) 00086 { 00087 Score score = obj as Score; 00088 if (score != null) 00089 { 00090 return this.CompareTo(score); 00091 } 00092 00093 throw new ArgumentException("Object must a a Score in order to compare it with another score object"); 00094 } 00095 00101 public int CompareTo(Score other) 00102 { 00103 return (this.Value * 10 - this.Eta).CompareTo((other.Value * 10 - other.Eta)); 00104 } 00105 00106 #endregion 00107 00108 public override string ToString() 00109 { 00110 return "Target: " + this.Target + " value: " + Value + " Enemy: " + EnemyShips + " ETA: " + Eta; 00111 } 00112 } 00113 00117 public enum TargetType 00118 { 00119 Island, 00120 NoTarget, 00121 EnemyGroup 00122 } 00123 }
1.7.6.1