public static void DrawProgress(iMatrix m, int[] inputValues, int[] outputValues, DrawData drawData) { if ((DateTime.Now - time) > timespan) { //считаем число операций в сек. long opsPerSec = 0; if ((m.RowCombinationCounter > LastRowCounter) && time != DateTime.MinValue) { try { var denom = (DateTime.Now - time).TotalSeconds; var nomin = (double)new Numerics.BigRational(m.RowCombinationCounter - LastRowCounter); opsPerSec = (long)(nomin / denom); } catch { opsPerSec = 0; } } LastRowCounter = m.RowCombinationCounter; time = DateTime.Now; Console.Write(" \r"); DrawWheel(); Console.WriteLine(String.Format(" Level: {0}.{1} ({2}) ", drawData.level, drawData.levelCount, drawData.levelTotal)); Console.WriteLine(String.Format(" Metrika: {0} ", drawData.currentMetrika)); Console.WriteLine(String.Format(" Speed: {0} ", ((opsPerSec != 0) ? opsPerSec.ToString("N0") : "?"))); Console.WriteLine("Teaching last row:"); MatrixDraw.DrawMatrix(m); CursorUp(4 + m.yHeight * 2); } }
public static void DrawMatrix(iMatrix matr) { for (var i = matr.yHeight - 1; i >= 0; i--) { DrawMatrixRowWithVerticalWalls(matr, i); DrawMatrixHorizontalWalls(matr, i); Console.ResetColor(); } }
public static void CheckFoundMatrix(iMatrix m, byte[] inp, byte[] outp) { var matr = new iMatrixByte(m); int i = 0; foreach (var item in inp) { var res = matr.Process(item); Console.WriteLine(item + " => " + res + " (" + outp[i++] + ")"); } }
private static void DrawMatrixRowWithVerticalWalls(iMatrix matr, int rowNumber) { //var vertWalls = matr.Rows[rowNumber].rowItems.Select(t => t.v).ToArray(); var Cells = matr.Rows[rowNumber].rowItems.ToArray(); for (var i = 0; i < Cells.Length; i++) { Console.ForegroundColor = wallColors[(int)Cells[i].v]; WriteVertWallByIndex((int)Cells[i].v); //Console.Write("|");//vertWalls[i]); Console.ForegroundColor = ConsoleColor.DarkGray; Console.Write(Cells[i].Memo); Console.ResetColor(); Console.Write(Cells[i].Output); } Console.WriteLine(); }
private static void DrawMatrixHorizontalWalls(iMatrix matr, int rowNumber) { if (rowNumber >= matr.Rows.Size) { return; } else { var horWalls = matr.Rows[rowNumber].rowItems.Select(t => t.h).ToArray(); for (var i = 0; i < horWalls.Length; i++) { Console.ForegroundColor = wallColors[(int)horWalls[i]]; WriteHorizontalWallByIndex((int)horWalls[i]); } Console.WriteLine(); } }