コード例 #1
0
        string GetInfoString()
        {
            string info = @"Statistics";

            info += string.Format("\nWidth: {0}, ", width);
            info += string.Format("Height: {0};", height);
            info += string.Format("\nTick number: {0};", universe.GetTicksCount());

            Tuple <ICell, int> mostFit = GetUniverse().GetMostFit();

            if (mostFit.Item1 == null)
            {
                info += "\nNone cell;";
            }
            else
            {
                ICell cell       = mostFit.Item1;
                int   cellsCount = mostFit.Item2;
                info += string.Format("\nCells count: {0};\nMost fit genome({1} cells):", universe.GetCellsCount(), cellsCount);

                info += string.Format("\n\tDescriptor: {0};\n\tHunger = {1};\n\tAggression: {2};\n\tFriendly: {3};\n\tReproduction: {4};",
                                      cell.GetDescriptor(),
                                      cell.GetGenome().GetHunger(),
                                      cell.GetGenome().GetAggression(),
                                      cell.GetGenome().GetFriendly(),
                                      cell.GetGenome().GetReproduction()
                                      );
            }
            return(info);
        }