public override void Draw() { int size = _mode.SquareSize, x = 0, y = 0; var p = _properties; // draw information bar InformationBar.Draw(_stopWatch.GetTime(), (_mode.Board as MinesweeperBoard).Flag); // draw each squares on the board foreach (string representativeChar in _mode.Board.DrawableBoard) { // draw the whole square Bitmap image = BitmapList.GetBitmap(representativeChar); // x and y must all be substracted with its respective offsets SplashKit.DrawBitmapOnWindow( SplashKit.CurrentWindow(), image, p.MarginLeft + x * size - p.SquareOffsetX, p.MarginTop + y * size - p.SquareOffsetY, p.SquareOptions ); // advances to another row if (x++ == _mode.Board.Width - 1) { x = 0; y++; } } }
private void Run(IList <String> codes) { OpenSession(); StopWatch stopWatch = new StopWatch(); stopWatch.Start(); for (int i = 0, length = 1000; i < length; i++) { if (i % 50 == 0) { ResetSession(); } LookupCodes(codes); } stopWatch.Stop(); CloseSession(); System.Console.Out.WriteLine(stopWatch.GetTime()); }