//TODO : implement statistic public override void StartGame(StartGameContext context) { var opponentName = ""; //this.opponentType = OpponentEvaluationType.Tornado; foreach (var name in context.PlayerNames) { if (name != this.Name) { opponentName = name.Substring(0, 7); } } this.stats = new Statistic(opponentName); this.startMoney = context.StartMoney; }
public void Run(IContext ctx) { resultSet = new DataSet(); DataTable sequenceTable = new DataTable() { TableName = "ModifiedSequence" }; sequenceTable.Columns.Add("X"); var h = new ParamsHelper(data.Tables["params"]); var attrs = typeof(Modification).GetCustomAttributes<ParameterAttribute>(); var tableName = h.GetValue<string>("Table Name"); var size = h.GetValue<int>("Size"); var start = h.GetValue<int>("Start"); var lambda = h.GetValue<double>("Lambda"); var type = h.GetValue<int>("TransformationType"); DataTable src = ctx.Data.Tables[tableName]; if (src == null) { var sb = new StringBuilder(); for (var i = 0; i < ctx.Data.Tables.Count; i++) { sb.AppendFormat(sb.Length > 0 ? "{0}, " : "{0}", ctx.Data.Tables[i].TableName); } throw new Exception(string.Format("No table '{0}' found in the input dataset. There is only '{1}' tables found", tableName, sb.ToString())); } double[] series = GetTableValues(src, 0); //разбиение var N = series.Length; stat = new Statistic(N); List<double> modified = new List<double>(); int negCount = 0; transform(series, modified, start, Math.Min(start + size, N), type, lambda, out negCount); for (int j = 0; j < modified.Count; j++) { DataRow row = sequenceTable.NewRow(); row["X"] = modified[j]; sequenceTable.Rows.Add(row); } resultSet.Tables.Add(sequenceTable); }