Ejemplo n.º 1
0
        private static string TrainingInt(IList <GameInfo> rows)
        {
            StringBuilder res = new StringBuilder();

            foreach (var row in rows)
            {
                row.TrimMoves();
                if (!row.IsValid())
                {
                    continue;
                }
                res.Append($"GameId:{row.Game.Id} ");
                int machProfit = row.AreLastTwoMovesEqual() ?
                                 row.Game.Surplus - (int)row.Game.TurksProfit :
                                 row.Game.MachineDisValue;
                res.Append($"MProfit:{machProfit} ");

                res.Append($"MDis:{row.Game.MachineDisValue} ");
                res.Append($"MStarts:{(row.Game.MachineStarts ? 1 : 0)} ");
                int i;
                for (i = 0; i < row.Moves.Count; i++)
                {
                    var move = row.Moves[i];
                    res.Append($"{move.MoveBy[0]}:{move.ProposedAmount} ");
                }
                res.AppendLine();
                res.AppendLine("Moves TConc  MConc  TFirst  MFirst TLast1 MLast1 TLast  MLast TDisV");
                Debug.Assert(row.Moves.Count > 0);
                i = row.Game.MachineStarts ? 0 : 1;
                for (; i < row.Moves.Count; i += 2)
                {
                    var moves = row.MovesToFloat();
                    var s     = SubHistory.GetSubHistory(i, row.Game.MachineDisValue, row.Game.ShowMachinesDisValue ? row.Game.TurksDisValue : -1, row.Game.MachineStarts, moves);
                    res.AppendFormat("{0,4}", i);
                    res.AppendFormat("{0,6}", s[SubHistory.TurksLastConcessionIndex]);
                    res.AppendFormat("{0,7}", s[SubHistory.MachinesLastConcessionIndex]);
                    res.AppendFormat("{0,7}", s[SubHistory.TurksFirstOfferIndex]);
                    res.AppendFormat("{0,7}", s[SubHistory.MachinesFirstOfferIndex]);
                    res.AppendFormat("{0,7}", s[SubHistory.TurksLastOfferIndex]);
                    res.AppendFormat("{0,7}", s[SubHistory.MachinesLast1OfferIndex]);
                    res.AppendFormat("{0,7}", s[SubHistory.TurksLastOfferIndex]);
                    res.AppendFormat("{0,7}", s[SubHistory.MachinesLastOfferIndex]);
                    res.AppendFormat("{0,7}", s[SubHistory.TurksDisValueIndex]);

                    res.AppendLine();
                }
            }

            return(res.ToString());
        }
Ejemplo n.º 2
0
        private static string TrainingNormalized(IList <GameInfo> rows)
        {
            StringBuilder res = new StringBuilder();

            foreach (var row in rows)
            {
                row.TrimMoves();
                if (!row.IsValid())
                {
                    continue;
                }
                int machProfit = row.AreLastTwoMovesEqual() ?
                                 row.Game.Surplus - (int)row.Game.TurksProfit :
                                 row.Game.MachineDisValue;
                int i;
                for (i = 0; i < row.Moves.Count; i++)
                {
                    var move = row.Moves[i];
                }
                Debug.Assert(row.Moves.Count > 0);
                i = row.Game.MachineStarts ? 0 : 1;
                for (; i < row.Moves.Count; i += 2)
                {
                    res.Append($"{row.Game.MachineDisValue} ");
                    res.Append($"{(row.Game.MachineStarts ? 1 : 0)} ");

                    var moves = row.MovesToFloat();
                    var s     = SubHistory.GetSubHistory(i, row.Game.MachineDisValue, row.Game.ShowMachinesDisValue ? row.Game.TurksDisValue : -1, row.Game.MachineStarts, moves);
                    res.AppendFormat("{0} ", i);
                    res.AppendFormat("{0} ", s[SubHistory.TurksLastConcessionIndex]);
                    res.AppendFormat("{0} ", s[SubHistory.MachinesLastConcessionIndex]);
                    res.AppendFormat("{0} ", s[SubHistory.TurksFirstOfferIndex]);
                    res.AppendFormat("{0} ", s[SubHistory.MachinesFirstOfferIndex]);
                    res.AppendFormat("{0} ", s[SubHistory.TurksLast1OfferIndex]);
                    res.AppendFormat("{0} ", s[SubHistory.MachinesLast1OfferIndex]);
                    res.AppendFormat("{0} ", s[SubHistory.TurksLastOfferIndex]);
                    res.AppendFormat("{0} ", s[SubHistory.MachinesLastOfferIndex]);
                    res.AppendFormat("{0} ", s[SubHistory.TurksDisValueIndex]);
                    res.AppendFormat("{0} ", machProfit);
                    res.AppendLine();
                }
            }

            return(res.ToString());
        }
Ejemplo n.º 3
0
 internal float[] GetSubHistory(int i) => SubHistory.GetSubHistory(i, Game.MachineDisValue, Game.ShowMachinesDisValue ? Game.TurksDisValue : -1, Game.MachineStarts, MovesToFloat());