public double[,] PlacementAnalysis(string key, int amount, string mode) { int totalNumbers = 0; double[,] placeFreq = new double[columns, rows]; double[,] placePct = new double[columns, rows]; for (int columnCount = 0; columnCount < columns; columnCount++) { for (int rowCount = 0; rowCount < rows; rowCount++) { placeFreq[columnCount, rowCount] = 0; } } Generator gen = new Generator(key); List<int[,]> analysedCards = gen.GenerateCard(amount); foreach (int[,] item in analysedCards) { if (item[0, 0] != -1) { for (int columnCount = 0; columnCount < columns; columnCount++) { for (int rowCount = 0; rowCount < rows; rowCount++) { if (item[columnCount, rowCount] != 0) { placeFreq[columnCount,rowCount]++; totalNumbers++; } } } } } if (mode == "freq") return placeFreq; else if (mode == "pct") { for (int columnCount = 0; columnCount < columns; columnCount++) { for (int rowCount = 0; rowCount < rows; rowCount++) { placePct[columnCount, rowCount] = (placeFreq[columnCount, rowCount] / totalNumbers) * 100; } } return placePct; } return placePct; //Volvo pls fix }
static void Main(string[] args) { string key; int pladeCount; Console.WriteLine("enter key"); key = Console.ReadLine(); Console.WriteLine("enter antal plader"); pladeCount = Convert.ToInt32(Console.ReadLine()); Generator gen = new Generator(key); List<int[,]> cards = gen.GenerateCard(pladeCount); // PDFMaker.MakePDF(cards); //make object instead }
public double[] EndNumberAnalysis(string key, int amount, string mode) { const int endnumbers = 10; int totalNumbers = 0; double[] endNumberFreq = new double[endnumbers]; double[] endNumberPct = new double[endnumbers]; for (int i = 0; i < endnumbers; i++) { endNumberFreq[i] = 0; endNumberPct[i] = 0; } Generator gen = new Generator(key); List<int[,]> analysedCards = gen.GenerateCard(amount); foreach (int[,] item in analysedCards) { if (item[0, 0] != -1) { for (int columnCount = 0; columnCount < columns; columnCount++) { for (int rowCount = 0; rowCount < rows; rowCount++) { if (item[columnCount, rowCount] != 0) { endNumberFreq[(item[columnCount,rowCount] % 10)]++; totalNumbers++; } } } } } if (mode == "freq") return endNumberFreq; else if (mode == "pct") { for (int i = 0; i < endnumbers; i++) { endNumberPct[i] = (endNumberFreq[i] / totalNumbers) * 100; } return endNumberPct; } else return endNumberPct; //volvo pls fix }
private void worker_DoWork(object sender, DoWorkEventArgs e) { _log.Info("Async plate-generation running..."); _generating = true; Generator gen = new Generator(Seed); PDFMaker maker = new PDFMaker(); maker.MakePDF(gen.GenerateCard(_platesGenerated)); }