1. C# / Говнокод #28793

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    public class Archvile:Actor{public Archvile(){Health=700;Radius=20;Height=56;Mass=500;Speed=15;PainChance=10;Monster=true;MaxTargetRange=896;SetFlag(Flags.QUICKTORETALIATE,true);SetFlag(Flags.FLOORCLIP,true);SetFlag(Flags.NOTARGET,true);SeeSound="vile/sight";PainSound="vile/pain";DeathSound="vile/death";ActiveSound="vile/active";MeleeSound="vile/stop";Obituary="$OB_VILE";Tag="$FN_ARCH";}
    public override void BeginPlay(){base.BeginPlay();SetState("Spawn");}
    void Spawn(){SetState("See");}
    void See(){A_Chase();}
    void Missile(){A_VileStart();A_FaceTarget();A_VileTarget();A_FaceTarget();A_VileAttack();Delay(20);SetState("See");}
    void Heal(){Delay(10);SetState("See");}
    void Pain(){A_Pain();SetState("See");}
    void Death(){A_Scream();A_NoBlocking();Delay(7);SetState("Death   1");}
    void Death1(){Delay(7);SetState("Death   2");}
    void Death2(){Delay(7);SetState("Death   3");}
    void Death3(){Delay(7);SetState("Death   4");}
    void Death4(){Delay(7);SetState("Death   5");}
    void Death5(){Delay(7);SetState("Death   6");}
    void Death6(){Delay(7);SetState("Death   7");}
    void Death7(){Delay(1);Destroy();}
    void A_VileStart(){StartSound("vile/start",CHAN_VOICE);}
    void A_VileTarget(){if(target!=null){A_FaceTarget();Actor fog=Spawn<Actor>("ArchvileFire",target.Pos,SpawnFlags.ALLOW_REPLACE);if(fog!=null){tracer=fog;fog.target=self;fog.tracer=self.target;fog.A_Fire(0);}}}
    void A_VileAttack(){Actor targ=target;if(targ!=null){A_FaceTarget();if(!CheckSight(targ,0))return;StartSound("vile/stop",CHAN_WEAPON);int newdam=targ.DamageMobj(self,self,20,DamageType.none);if(newdam>0)targ.TraceBleed(newdam,self);Actor fire=tracer;if(fire!=null){fire.SetOrigin(targ.Vec3Angle(-24.0,angle,0),true);fire.A_Explode(70,70,ExplosionFlags.XF_NOSPLASH,false,0,0,0,"BulletPuff",DamageType.Fire);}
    if(!targ.bDontThrust){targ.Vel.z=1000.0*thrust/Math.Max(1,targ.Mass);}}}
    void A_StartFire(){StartSound("vile/firestrt",CHAN_BODY);A_Fire();}
    void A_Fire(){Actor dest=tracer;if(dest==null||target==null)return;if(!target.CheckSight(dest,0))return;SetOrigin(dest.Vec3Angle(24,dest.angle,0),true);}
    void A_FireCrackle(){StartSound("vile/firecrkl",CHAN_BODY);A_Fire();}}
    public static class ActorExtensions{public static void A_VileStart(this Actor self){self.StartSound("vile/start",CHAN_VOICE);}
    public static void A_VileTarget(this Actor self,string fire="ArchvileFire"){if(self.target!=null){self.A_FaceTarget();Actor fog=self.Spawn<Actor>(fire,self.target.Pos,SpawnFlags.ALLOW_REPLACE);if(fog!=null){self.tracer=fog;fog.target=self;fog.tracer=self.target;fog.A_Fire(0);}}}
    public static void A_VileAttack(this Actor self,string snd="vile/stop",int initialdmg=20,int blastdmg=70,int blastradius=70,double thrust=1.0,string damagetype="Fire",int flags=0){Actor targ=self.target;if(targ!=null){self.A_FaceTarget();if(!self.CheckSight(targ,0))return;self.StartSound(snd,CHAN_WEAPON);int newdam=targ.DamageMobj(self,self,initialdmg,(flags

    Арчвайл из ZDooM на C#

    DartPower, 07 Июня 2023

    Комментарии (0)
  2. C# / Говнокод #28648

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    protected override Detail GetDetailPage(
                aggregate aggregate, 
                int cashbackRate,
                BannerResponse bannerInfo,
                List<MediaShortResponse> mediaInfo,
                EntityFavourites likeCountInfo, 
                List<FavouriteEntity> likeInfo)
            {
                var announcementDetail = new Detail
                (
                    aggregate.Details.Id,
                    aggregate.Details.Alias,
                    aggregate.Details.Title,
                    aggregate.Details.Description,
                    aggregate.Details.DescriptionShortcut,
                    aggregate.Details.Age,
                    aggregate.ExtendedDetails.DataSourceId,
                    aggregate.ExtendedDetails.DataSourceItemId,
                    cashbackRate,
                    null,
                    aggregate.ExtendedDetails.LastEventDateTime,
                    aggregate.ExtendedDetails.EventClosestDateTime,
                    aggregate.ExtendedDetails.Url,
                    aggregate.ExtendedDetails.Category != null
                        ? new AnnouncementCategory(aggregate.ExtendedDetails.Category.Id, 
                            aggregate.ExtendedDetails.Category.Title,
                            aggregate.ExtendedDetails.Category.Url)
                        : null,
                    aggregate.ExtendedDetails.Tags?.Select(ss =>
                        new Tag(ss.Title, HttpUtility.UrlPathEncode(ss.Url))
                    ).ToList(),
                    aggregate.Details.Privileges?.Select(ss => new Privilege()
                    {
                        Description = ss.Description,
                        Id = ss.Id,
                        ImageUrl = ss.ImageUrl.ToString(),
                        Title = ss.Title
                    }).ToList(),
                    mediaInfo.Select(m => new Media
                    {
                        Type = m.Type,
                        Url = m.Url
                    }).ToList(),
                    aggregate.ExtendedDetails.EventMinPrice,
                    likeInfo.FirstOrDefault(x => x.EntityId == aggregate.Details.Id)?.IsSet ?? false,
                    likeCountInfo?.TotalCount,
                    aggregate.ExtendedDetails.Promotext,
                    bannerInfo != null ? new Banner { Url = bannerInfo.Url, ImageUrl = bannerInfo.ImageUrl } : null,
                    aggregate.Details.Venue != null
                        ? new ShortVenue(aggregate.Details.Venue.Id,
                            aggregate.Details.Venue.Title,
                            aggregate.Details.Venue.Url.Replace(_liveBaseAddress, ""),
                            aggregate.Details.Venue.Address)
                        : null,
                    (AnnouncementStatus)aggregate.Details.Status,
                    aggregate.ExtendedDetails.PremiumRule,
                    aggregate.Details.HasPrivilegeEnabled,
                );
    
                return announcementDetail;
     }

    tfnbupsc, 24 Марта 2023

    Комментарии (2)
  3. C# / Говнокод #28642

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    96. 96
    97. 97
    98. 98
    class StargateSimulator
    {
        static bool shieldEnabled = false;
    
        static void Main()
        {
            Console.WriteLine("Stargate Simulator");
            Console.WriteLine("------------------");
    
            // Check for zero point module
            Console.Write("Zero Point Module detected. Proceed with simulation? (y/n) ");
            string response = Console.ReadLine();
            if (response.ToLower() != "y")
            {
                Console.WriteLine("Simulation cancelled.");
                return;
            }
    
            // Enable shield
            Console.Write("Enable gate shield? (y/n) ");
            response = Console.ReadLine();
            if (response.ToLower() == "y")
            {
                EnableShield();
            }
    
            // Enter gate address
            Console.Write("Enter gate address: ");
            string address = Console.ReadLine();
            if (address.Length != 6 && address.Length != 8)
            {
                Console.WriteLine("Invalid address length.");
                return;
            }
    
            // Dial gate
            Dial(address);
    
            Console.WriteLine("Simulation complete.");
        }
    
        static void Dial(string address)
        {
            // Check for valid address
            if (address.Length != 6 && address.Length != 8)
            {
                Console.WriteLine("Invalid address length.");
                return;
            }
    
            // Check for energy source
            Console.Write("Energy source detected. Proceed with dialing? (y/n) ");
            string response = Console.ReadLine();
            if (response.ToLower() != "y")
            {
                Console.WriteLine("Dialing cancelled.");
                return;
            }
    
            // Dial gate
            Console.WriteLine("Dialing gate...");
            if (shieldEnabled)
            {
                Console.WriteLine("Gate shield is active.");
            }
            Console.WriteLine("Chevron 1 encoded.");
            Console.WriteLine("Chevron 2 encoded.");
            Console.WriteLine("Chevron 3 encoded.");
            Console.WriteLine("Chevron 4 encoded.");
            Console.WriteLine("Chevron 5 encoded.");
            Console.WriteLine("Chevron 6 encoded.");
            if (address.Length == 8)
            {
                Console.WriteLine("Chevron 7 encoded.");
                Console.WriteLine("Gate engaged.");
            }
            else
            {
                Console.WriteLine("Gate engaged.");
            }
        }
    
        static void EnableShield()
        {
            // Check for available power
            Console.Write("Power levels stable. Activate gate shield? (y/n) ");
            string response = Console.ReadLine();
            if (response.ToLower() != "y")
            {
                Console.WriteLine("Shield activation cancelled.");
                return;
            }
    
            // Activate shield
            Console.WriteLine("Shield activated.");
            shieldEnabled = true;
        }
    }

    Симулятор наборного устройства звездных врат.

    P.S. За Канон-френдли не отвечаю, т.к. фанат серии но любитель немножко поизвращаться над ЛОРом...

    DartPower, 19 Марта 2023

    Комментарии (4)
  4. C# / Говнокод #28641

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    namespace TimeMachineSimulator
    {
        class Program
        {
            static void Main()
            {
                Console.WriteLine("Welcome to the Time Machine Simulator!");
                TimeMachine machine = new();
                while (true)
                {
                    Console.WriteLine("What would you like to do?");
                    Console.WriteLine("1. Travel in time");
                    Console.WriteLine("2. Show current time");
                    Console.WriteLine("3. Show travel history");
                    Console.WriteLine("4. Exit");
                    string input = Console.ReadLine();
                    Console.WriteLine();
                    switch (input)
                    {
                        case "1":
                            Console.Write("Enter the number of years to travel: ");
                            int years = int.Parse(Console.ReadLine());
                            try
                            {
                                machine.Travel(years);
                                Console.WriteLine("Travel successful.");
                            }
                            catch (TimeMachineException e)
                            {
                                Console.WriteLine(e.Message);
                            }
                            break;
                        case "2":
                            Console.WriteLine("Current time: " + machine.GetCurrentTime());
                            break;
                        case "3":
                            List<DateTime> history = machine.GetTravelHistory();
                            Console.WriteLine("Travel history:");
                            foreach (DateTime time in history)
                            {
                                Console.WriteLine(time);
                            }
                            Console.WriteLine();
                            break;
                        case "4":
                            Console.WriteLine("Thank you for using the Time Machine Simulator! Press any key to exit...");
                            Console.ReadKey();
                            return;
                        default:
                            Console.WriteLine("Invalid input. Please try again.");
                            break;
                    }
                }
            }
        }
    
        public class TimeMachineException : Exception { public TimeMachineException(string message) : base(message){}}
    
        public class TimeMachine
        {
            private DateTime currentTime;
            private readonly List<DateTime> travelHistory;
            public TimeMachine()
            {
                this.currentTime = DateTime.Now;
                this.travelHistory = new List<DateTime>();
            }
            public void Travel(int years)
            {
                DateTime futureTime = this.currentTime.AddYears(years);
                if (futureTime > DateTime.Now)
                {
                    throw new TimeMachineException("Cannot travel to the future!");
                }
                this.currentTime = futureTime;
                this.travelHistory.Add(futureTime);
            }
            public DateTime GetCurrentTime()
            {
                return this.currentTime;
            }
            public List<DateTime> GetTravelHistory()
            {
                return this.travelHistory;
            }
        }
    }

    Пространственно-временной квантовый реинтегратор. Правда в будущее не умеет отправлять, но используя свойства реверсивной энтропии может отправить куда угодно только в прошлое!

    DartPower, 19 Марта 2023

    Комментарии (0)
  5. C# / Говнокод #28640

    0

    1. 1
    namespace NardeGame { public class NardeGame { static void Main() { Console.WriteLine("Welcome to Narde Game!"); NardeGame game = new(); game.Play(); Console.WriteLine("Thank you for playing Narde Game! Press any key to exit..."); Console.ReadKey(); } private readonly Player player1; private readonly Player player2; private readonly Board board; public NardeGame() { player1 = new Player("Armen"); player2 = new Player("Suren"); board = new Board(); } public void Play() { while (!board.IsGameOver()) { Player currentPlayer = board.GetTurn() == Turn.WHITE ? player1 : player2; Console.WriteLine("It's " + currentPlayer.GetName() + "'s turn."); Console.WriteLine(board); int from, to; do { Console.Write("Enter the starting point of your move: "); from = int.Parse(Console.ReadLine()); Console.Write("Enter the ending point of your move: "); to = int.Parse(Console.ReadLine()); } while (!Board.IsValidMove(from, to, currentPlayer.GetColor())); Board.MakeMove(from, to); board.NextTurn(); } Console.WriteLine("Game over."); Console.WriteLine(board); Console.WriteLine(board.GetWinner().GetName() + " won!"); } } public enum Color { WHITE, BLACK } public enum Turn { WHITE, BLACK } public class Player { private readonly string name; private readonly Color color; public Player(string name) { this.name = name; color = name == "Armen" ? Color.WHITE : Color.BLACK; } public string GetName() { return name; } public Color GetColor() { return color; } } public class Board { private readonly int[] points; private Turn turn; public Board() { points = new int[24] { 2, 0, 0, 0, 0, -5, 0, 3, 0, 0, 0, -5, 5, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, -2 }; turn = Turn.WHITE; } public bool IsGameOver() { int whiteCount = 0; int blackCount = 0; for (int i = 0; i < 24; i++) { if (points[i] > 0) { whiteCount += points[i]; } else if (points[i] < 0) { blackCount -= points[i]; } } return whiteCount == 0 || blackCount == 0; } public Player? GetWinner() { int whiteCount = 0; int blackCount = 0; for (int i = 0; i < 24; i++) { if (points[i] > 0) { whiteCount += points[i]; } else if (points[i] < 0) { blackCount -= points[i]; } } if (whiteCount > blackCount) { return new Player("Armen"); } else if (blackCount > whiteCount) { return new Player("Suren"); } else { return null; } } public Turn GetTurn() { return turn; } public void NextTurn() { turn = turn == Turn.WHITE ? Turn.BLACK : Turn.WHITE; } public static bool IsValidMove(int from, int to, Color color) { return true; } public static void MakeMove(int from, int to) { } public override string ToString() { string output = ""; for (int i = 0; i < 24; i++) { output += points[i] + " "; } return output.TrimEnd(); } } }

    Армяне играют в однострочные нарды... :)

    DartPower, 19 Марта 2023

    Комментарии (0)
  6. C# / Говнокод #28639

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    namespace ParticleAccelSim
    {
        public class Particle
        {
            public double X { get; set; } // координата частицы по оси x
            public double Y { get; set; } // координата частицы по оси y
            public double VX { get; set; } // скорость частицы по оси x
            public double VY { get; set; } // скорость частицы по оси y
            public double Mass { get; set; } // масса частицы
            public double Charge { get; set; } // заряд частицы
    
            public Particle(double x, double y, double vx, double vy, double mass, double charge)
            {
                X = x;
                Y = y;
                VX = vx;
                VY = vy;
                Mass = mass;
                Charge = charge;
            }
        }
    	
        public class ParticleAccelerator
        {
            private List<Particle> particles = new List<Particle>(); // список всех частиц
            private double timeStep = 0.01; // размер шага при моделировании
    
            public void AddParticle(Particle p)
            {
                particles.Add(p);
            }
    
            public void RunSimulation(int numSteps)
            {
                for (int i = 0; i < numSteps; i++)
                {
                    foreach (Particle p in particles)
                    {
                        // вычисляем силы, действующие на частицу
                        double ax = 0;
                        double ay = 0;
    
                        foreach (Particle other in particles)
                        {
                            if (other != p)
                            {
                                double dx = other.X - p.X;
                                double dy = other.Y - p.Y;
                                double r = Math.Sqrt(dx * dx + dy * dy);
                                double f = (p.Charge * other.Charge) / (r * r); // закон Кулона
    
                                ax += f * dx / r;
                                ay += f * dy / r;
                            }
                        }
    
                        // вычисляем новое положение и скорость частицы
                        p.VX += ax * timeStep / p.Mass;
                        p.VY += ay * timeStep / p.Mass;
                        p.X += p.VX * timeStep;
                        p.Y += p.VY * timeStep;
                    }
                }
            }
        }
    }

    Исходный код симулятора ускорителя частиц, например "Большой адронный коллайдер". Просьба не запускать этот код, т.к. я уже пару дней назад запустил, а сегодня уже не могу понять правильно говорить "Возможность этого резиста крайне мала" или "Вероятность этого резиста крайне мала"... ТАК ЧТО БУДЬТЕ ОСТОРОЖНЫ! Можно сломать нашу реальность!

    DartPower, 19 Марта 2023

    Комментарии (2)
  7. C# / Говнокод #28591

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    /// <summary>
        /// Converts an object to null. Returns null.
        /// </summary>
        public static object ToNull(this object value)
        {
          return null;
        }

    Индийский extension

    bugotrep, 07 Февраля 2023

    Комментарии (5)
  8. C# / Говнокод #28425

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    public class Solution 
    {
        public string RemoveStars(string s) 
        {
            char[] str = new char[s.Length];
            int l = 0;
            
            for(int i = 0; i < s.Length; ++i)
                if(s[i] == '*')
                    --l;
                else
                    str[l++] = s[i];
            
            return new string(str, 0, l);
        }
    }

    решил выйти из выгорания изучением новой технологии. литкод оказался прикольной штукой..

    kcalbCube, 23 Октября 2022

    Комментарии (46)
  9. C# / Говнокод #28377

    −2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    private delegate void XFXOPDO(byte cmd);
    
    	private delegate void FXCBOPDO(byte cmd, ushort adr);
    
    	private delegate void ALUALGORITHM(byte src);
    
    	public delegate byte MEMREADER(ushort ADDR);
    
    	public ulong Tact;
    
    	public Registers regs = new Registers();
    
    	public bool HALTED;
    
    	public bool IFF1;
    
    	public bool IFF2;
    
    	public byte IM;
    
    	public bool BlockINT;
    
    	public OPFX FX;
    
    	public OPXFX XFX;
    
    	public bool INT;
    
    	public bool NMI;
    
    	public bool RST;
    
    	public byte FreeBUS = byte.MaxValue;
    
    	public OnRDMEM ReadMemory;
    
    	public OnWRMEM WriteMemory;
    
    	public OnRDPORT ReadPort;
    
    	public OnWRPORT WritePort;
    
    	public OnCALLBACK OnCycle;
    
    	private XFXOPDO[] opTABLE;
    
    	private XFXOPDO[] fxopTABLE;
    
    	private XFXOPDO[] edopTABLE;
    
    	private XFXOPDO[] cbopTABLE;
    
    	private FXCBOPDO[] fxcbopTABLE;
    
    	private static byte[] conds = new byte[4] { 64, 1, 4, 128 };
    
    	private static ALUALGORITHM[] alualg;
    
    	private ALUALGORITHM[] alulogic;
    
    	private static readonly string[] DirectZ80Code = new string[256]
    	{
    		"NOP", "LD     BC,$W", "LD     (BC),A", "INC    BC", "INC    B", "DEC    B", "LD     B,$N", "RLCA", "EX     AF,AF'", "ADD    HL,BC",
    		"LD     A,(BC)", "DEC    BC", "INC    C", "DEC    C", "LD     C,$N", "RRCA", "DJNZ   $DIS", "LD     DE,$W", "LD     (DE),A", "INC    DE",
    		"INC    D", "DEC    D", "LD     D,$N", "RLA", "JR     $DIS", "ADD    HL,DE", "LD     A,(DE)", "DEC    DE", "INC    E", "DEC    E",
    		"LD     E,$N", "RRA", "JR     NZ,$DIS", "LD     HL,$W", "LD     ($W),HL", "INC    HL", "INC    H", "DEC    H", "LD     H,$N", "DAA",
    		"JR     Z,$DIS", "ADD    HL,HL", "LD     HL,($W)", "DEC    HL", "INC    L", "DEC    L", "LD     L,$N", "CPL", "JR     NC,$DIS", "LD     SP,$W",
    		"LD     ($W),A", "INC    SP", "INC    (HL)", "DEC    (HL)", "LD     (HL),$N", "SCF", "JR     C,$DIS", "ADD    HL,SP", "LD     A,($W)", "DEC    SP",
    		"INC    A", "DEC    A", "LD     A,$N", "CCF", "LD     B,B", "LD     B,C", "LD     B,D", "LD     B,E", "LD     B,H", "LD     B,L",
    		"LD     B,(HL)", "LD     B,A", "LD     C,B", "LD     C,C", "LD     C,D", "LD     C,E", "LD     C,H", "LD     C,L", "LD     C,(HL)", "LD     C,A",
    		"LD     D,B", "LD     D,C", "LD     D,D", "LD     D,E", "LD     D,H", "LD     D,L", "LD     D,(HL)", "LD     D,A", "LD     E,B", "LD     E,C",
    		"LD     E,D", "LD     E,E", "LD     E,H", "LD     E,L", "LD     E,(HL)", "LD     E,A", "LD     H,B", "LD     H,C", "LD     H,D", "LD     H,E",
    		"LD     H,H", "LD     H,L", "LD     H,(HL)", "LD     H,A", "LD     L,B", "LD     L,C", "LD     L,D", "LD     L,E", "LD     L,H", "LD     L,L",
    		"LD     L,(HL)", "LD     L,A", "LD     (HL),B", "LD     (HL),C", "LD     (HL),D", "LD     (HL),E", "LD     (HL),H", "LD     (HL),L", "HALT", "LD     (HL),A",
    		"LD     A,B", "LD     A,C", "LD     A,D", "LD     A,E", "LD     A,H", "LD     A,L", "LD     A,(HL)", "LD     A,A", "ADD    A,B", "ADD    A,C",
    		"ADD    A,D", "ADD    A,E", "ADD    A,H", "ADD    A,L", "ADD    A,(HL)", "ADD    A,A", "ADC    A,B", "ADC    A,C", "ADC    A,D", "ADC    A,E",
    		"ADC    A,H", "ADC    A,L", "ADC    A,(HL)", "ADC    A,A", "SUB    B", "SUB    C", "SUB    D", "SUB    E", "SUB    H", "SUB    L",
    		"SUB    (HL)", "SUB    A", "SBC    A,B", "SBC    A,C", "SBC    A,D", "SBC    A,E", "SBC    A,H", "SBC    A,L", "SBC    A,(HL)", "SBC    A,A",
    		"AND    B", "AND    C", "AND    D", "AND    E", "AND    H", "AND    L", "AND    (HL)", "AND    A", "XOR    B", "XOR    C",
    		"XOR    D", "XOR    E", "XOR    H", "XOR    L", "XOR    (HL)", "XOR    A", "OR     B", "OR     C", "OR     D", "OR     E",
    		"OR     H", "OR     L", "OR     (HL)", "OR     A", "CP     B", "CP     C", "CP     D", "CP     E", "CP     H", "CP     L",
    		"CP     (HL)", "CP     A", "RET    NZ", "POP    BC", "JP     NZ,$W", "JP     $W", "CALL   NZ,$W", "PUSH   BC", "ADD    A,$N", "RST    $T",
    		"RET    Z", "RET", "JP     Z,$W", "*CB", "CALL   Z,$W", "CALL   $W", "ADC    A,$N", "RST    $T", "RET    NC", "POP    DE",
    		"JP     NC,$W", "OUT    ($N),A", "CALL   NC,$W", "PUSH   DE", "SUB    $N", "RST    $T", "RET    C", "EXX", "JP     C,$W", "IN     A,($N)",
    		"CALL   C,$W", "*IX", "SBC    A,$N", "RST    $T", "RET    PO", "POP    HL", "JP     PO,$W", "EX     (SP),HL", "CALL   PO,$W", "PUSH   HL",
    		"AND    $N", "RST    $T", "RET    PE", "JP     (HL)", "JP     PE,$W", "EX     DE,HL", "CALL   PE,$W", "*ED", "XOR    $N", "RST    $T",
    		"RET    P", "POP    AF", "JP     P,$W", "DI", "CALL   P,$W", "PUSH   AF", "OR     $N", "RST    $T", "RET    M", "LD     SP,HL",
    		"JP     M,$W", "EI", "CALL   M,$W", "*IY", "CP     $N", "RST    $T"
    	};

    Вот так раньше писали эмуляторы ZX Spectrum

    DartPower, 20 Сентября 2022

    Комментарии (9)
  10. C# / Говнокод #28327

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    public static void Mein()
    	{
    		Govno8_Main.random_0 = new Random();
    		Govno8_Main.doubleBufferForm_0 = new Govno8.DoubleBufferForm();
    		Govno8_Main.byte_0 = ArrayModule.Create<byte>(4096, 0);
    		Govno8_Main.ushort_0 = 512;
    		Govno8_Main.string_0 = string.Empty;
    		Govno8_Main.openFileDialog_0 = new OpenFileDialog();
    		Govno8.OpenBinDialog.Title = "Open Chip-8 ROM File";
    		Govno8.OpenBinDialog.Filter = "Chip-8 ROM Files|*.ch8|All files|*.*";
    		switch (Govno8.OpenBinDialog.ShowDialog())
    		{
    			case DialogResult.OK:
    				{
    					byte[] array = File.ReadAllBytes(Govno8.OpenBinDialog.FileName);
    					if (array.Length != 0 && array.Length <= 3583)
    					{
    						Govno8.RomName = Govno8.OpenBinDialog.FileName;
    						array.CopyTo(Govno8.Memory, (int)Govno8.PC);
    					}
    					else
    					{
    						MessageBox.Show("Invalid ROM file", "FATAL ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand);
    						Environment.Exit(1);
    					}
    					break;
    				}
    			default:
    				Environment.Exit(1);
    				break;
    		}
    		Govno8_Main.byte_1 = new byte[]
    		{
    				240, 144, 144, 144, 240, 32, 96, 32, 32, 112,
    				240, 16, 240, 128, 240, 240, 16, 240, 16, 240,
    				144, 144, 240, 16, 16, 240, 128, 240, 16, 240,
    				240, 128, 240, 144, 240, 240, 16, 32, 64, 64,
    				240, 144, 240, 144, 240, 240, 144, 240, 16, 240,
    				240, 144, 240, 144, 144, 224, 144, 224, 144, 224,
    				240, 128, 128, 128, 240, 224, 144, 144, 144, 224,
    				240, 128, 240, 128, 240, 240, 128, 240, 128, 128
    		};
    		Govno8.Fontset.CopyTo(Govno8.Memory, 0);
    		Govno8_Main.ushort_1 = 0;
    		Govno8_Main.byte_2 = ArrayModule.Create<byte>(16, 0);
    		Govno8_Main.ushort_2 = 0;
    		Govno8_Main.ushort_3 = ArrayModule.Create<ushort>(16, 0);
    		Govno8_Main.ushort_4 = 0;
    		Govno8_Main.byte_3 = ArrayModule.Create<byte>(16, 0);
    		Govno8_Main.byte_4 = ArrayModule.Create<byte>(2048, 0);
    		Govno8_Main.byte_5 = 0;
    		Govno8_Main.byte_6 = 0;
    		Govno8_Main.dateTime_0 = DateTime.Now;
    		Govno8_Main.dateTime_1 = DateTime.Now;
    		Govno8_Main.fsharpAsync_0 = ExtraTopLevelOperators.DefaultAsyncBuilder.Delay<Unit>(Govno8.Class6.class6_0);
    		Govno8.Form.ClientSize = new Size(1024, 512);
    		CommonExtensions.AddToObservable<EventArgs>(Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.CreateEvent<EventHandler, EventArgs>(Govno8.Class7.class7_0, Govno8.Class8.class8_0, Govno8.Class10.class10_0), Govno8.Class11.class11_0);
    		CommonExtensions.AddToObservable<PaintEventArgs>(Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.CreateEvent<PaintEventHandler, PaintEventArgs>(Govno8.Class12.class12_0, Govno8.Class13.class13_0, Govno8.Class15.class15_0), Govno8.Class16.class16_0);
    		CommonExtensions.AddToObservable<KeyEventArgs>(Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.CreateEvent<KeyEventHandler, KeyEventArgs>(Govno8.Class17.class17_0, Govno8.Class18.class18_0, Govno8.Class20.class20_0), Govno8.Class21.class21_0);
    		CommonExtensions.AddToObservable<KeyEventArgs>(Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers.CreateEvent<KeyEventHandler, KeyEventArgs>(Govno8.Class22.class22_0, Govno8.Class23.class23_0, Govno8.Class25.class25_0), Govno8.Class26.class26_0);
    		Govno8.Form.Text = string.Format("{0} - Chip-F Emulator", Govno8.RomName);
    		Govno8.Form.MaximizeBox = false;
    		Govno8.Form.FormBorderStyle = FormBorderStyle.FixedSingle;
    		Application.Run(Govno8.Form);
    	}

    Три раза переваренный кал...
    Скомпилен F# код, затем декомпиленный в C# и подправленный чутка)))
    А, ну и ещё деобфускатором прошелся прикола ради, перед декомпиляцией.

    P.S. Кстати капча ниже содержала 666... Как иронично...

    DartPower, 10 Августа 2022

    Комментарии (3)