private void recordProfit(DataSetName name, SetStats setStats, IDictionary <DataSetName, double?> statsResults)
        {
            double?soFar = statsResults[name];

            if (soFar == null)
            {
                soFar = 0.0;
            }
            soFar += setStats.TotalPercent;
            statsResults[name] = soFar;
        }
Esempio n. 2
0
        public Snake(int PosX, int PosY, char[,] drawBuffer, GameOver gameOver, ObjectDeath objectDeath, SetStats setStats) : base(PosX, PosY)
        {               // Конструктор
            this.setStats    = setStats;
            this.gameOver    = gameOver;
            this.drawBuffer  = drawBuffer;
            this.objectDeath = objectDeath;

            stats = new int[2] {
                0, 0
            };
            touched        = new Dictionary <AbstractUnit, int>();
            touchedUpdates = new Dictionary <AbstractUnit, int>();
            links          = new List <SnakeLink>()
            {
                new SnakeLink(PosX, PosY + 1)
            };
        }
Esempio n. 3
0
        public Runtime(char[,] drawBuffer, int speed, string name)
        {
            this.name       = name;
            this.speed      = speed;
            this.drawBuffer = drawBuffer;

            stats       = new int[2];
            setStats    = UpdateStatistics;
            objectDeath = ObjectDeathFunc;
            gameOver    = delegate { exit = true; };
            snake       = new Snake((int)Math.Round((double)(drawBuffer.GetLength(1) - 1) / 2), (int)Math.Round((double)(drawBuffer.GetLength(0) - 1) / 2), drawBuffer, gameOver, objectDeath, setStats);
            units       = new List <AbstractUnit>()
            {
            };
            toRemove = new List <AbstractUnit>()
            {
            };
            drawer   = new Drawer(drawBuffer, freeCells);
            generate = new Generate(drawBuffer, units, objectDeath, freeCells);
        }