Example #1
0
 public GameData(InputData inputData, ArgParser argParser)
 {
     InputData = inputData;
     Units = inputData.units.Select(inputUnit => new Unit(inputUnit)).ToArray();
     var phrases = new List<PowerPhraseInfo>();
     phrases.Add(new PowerPhraseInfo("", -1));
     phrases.AddRange(argParser.PowerPhrases.Select((t, i) => new PowerPhraseInfo(t, i)));
     PowerPhraseData = new PowerPhraseData(phrases.ToArray(), argParser.PhraseMetricType);
 }
Example #2
0
        public static string PrettyPrint(InputData inputData)
        {
            //HashSet<Cell> cells = new HashSet<Cell>();

            string res = "";
            res += "Width: " + inputData.width + "\nHeight: " + inputData.height + "\n";
            res += "Number of seeds: " + inputData.sourceSeeds.Length + "\n";
            res += "Source length: " + inputData.sourceLength + "\n";

            double expectedTotalBricks = 0;
            foreach (var unit in inputData.units)
                expectedTotalBricks += unit.members.Length;
            expectedTotalBricks = expectedTotalBricks * inputData.sourceLength / inputData.units.Length;
            res += "Expected total bricks per seed: " + Math.Round(expectedTotalBricks) + "\n";
            res += "\n";

            for (int y = 0; y < inputData.height; ++y)
            {
                if (y % 2 == 1)
                    res += " ";
                for (int x = 0; x < inputData.width; ++x)
                {
                    if (inputData.filled.Contains(new Cell(x, y)))
                        res += "* ";
                    else
                        res += ". ";
                }
                res += "|\n";
            }

            res += "\nUnits:\n";
            res += "-----------------------------------------\n";

            foreach (var unit in inputData.units)
            {
                res += _PrettyPrint(unit.members, unit.pivot);
                res += "-----------------------------------------\n";

            }
            return res;
        }
Example #3
0
 public Field(InputData data)
     : this(data.height, data.width, data.filled)
 {
 }