Advertisement
Guest User

Детище щукина

a guest
Nov 26th, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | None | 0 0
  1. // Decompiled with JetBrains decompiler
  2. // Type: TargetReady.Module1
  3. // Assembly: TargetReady, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
  4. // MVID: 11AE42EA-88CF-462F-AC63-AE5393C940A5
  5. // Assembly location: C:\Users\Pavel\Desktop\Target\Demo.exe
  6. // Compiler-generated code is shown
  7.  
  8. using Microsoft.VisualBasic;
  9. using Microsoft.VisualBasic.CompilerServices;
  10. using System;
  11. using System.Diagnostics;
  12. using System.Threading;
  13.  
  14. namespace TargetReady
  15. {
  16. [StandardModule]
  17. internal sealed class Module1
  18. {
  19. public const short conMaxValue = (short) 15;
  20. public const short conSleep = (short) 30;
  21. public const short conStep = (short) 1;
  22. public const short conMaxScore = (short) 10;
  23.  
  24. [DebuggerNonUserCode]
  25. static Module1()
  26. {
  27. }
  28.  
  29. [STAThread]
  30. public static void Main()
  31. {
  32. VBMath.Randomize();
  33. while (true)
  34. {
  35. short num1;
  36. checked { ++num1; }
  37. Console.ForegroundColor = ConsoleColor.Magenta;
  38. Console.WriteLine("**************************************");
  39. Console.WriteLine("Выстрел: " + Conversions.ToString((int) num1));
  40. Console.WriteLine("**************************************");
  41. Console.ForegroundColor = ConsoleColor.White;
  42. Console.WriteLine("Определение X... Нажмите клавишу...");
  43. float number1 = Module1.GetNumber((short) 15, (short) 30);
  44. Console.ReadKey(true);
  45. Console.WriteLine();
  46. Console.WriteLine("X= " + Conversions.ToString(number1));
  47. Console.ReadLine();
  48. Console.WriteLine("Определение Y... Нажмите клавишу...");
  49. float number2 = Module1.GetNumber((short) 15, (short) 30);
  50. Console.ReadKey(true);
  51. Console.WriteLine();
  52. Console.WriteLine("Y= " + Conversions.ToString(number2));
  53. Console.ReadLine();
  54. short num2;
  55. num2 += Module1.CalcScore(number1, number2, (short) 10, (short) 1);
  56. Console.ForegroundColor = ConsoleColor.Yellow;
  57. Console.WriteLine("**************************************");
  58. Console.WriteLine("Шаг: " + Conversions.ToString((int) num1) + " Счет: " + Conversions.ToString((int) num2));
  59. Console.WriteLine("**************************************");
  60. Console.ForegroundColor = ConsoleColor.White;
  61. Console.WriteLine("Выйти? (y/Y)");
  62. if (Operators.CompareString(Strings.UCase(Console.ReadLine()), "Y", false) == 0)
  63. break;
  64. }
  65. }
  66.  
  67. public static float GetNumber(short shrMaxValue = (short) 15, short shrSleep = (short) 30)
  68. {
  69. float num;
  70. while (!Console.KeyAvailable)
  71. {
  72. num += VBMath.Rnd();
  73. if ((double) num > (double) shrMaxValue)
  74. num -= (float) checked (2 * (int) shrMaxValue);
  75. Thread.Sleep((int) shrSleep);
  76. Console.Write(Strings.Space(20));
  77. Console.CursorLeft = 0;
  78. Console.Write(num);
  79. Console.CursorLeft = 0;
  80. }
  81. return num;
  82. }
  83.  
  84. public static short CalcScore(float sngX, float sngY, short shrMax = (short) 10, short shrStep = (short) 1)
  85. {
  86. float num = (float) Math.Sqrt(Math.Pow((double) sngX, 2.0) + Math.Pow((double) sngY, 2.0));
  87. if ((double) num > (double) checked ((short) unchecked ((int) shrMax * (int) shrStep)))
  88. return (short) 0;
  89. return checked ((short) ((long) shrMax - unchecked (checked ((long) Math.Round((double) num)) / (long) shrStep)));
  90. }
  91. }
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement