<commit_before>﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MiniCraft.Entities;
using MiniCraft.Gfx;
using MiniCraft.Levels;
using MiniCraft.Levels.Tiles;
using MiniCraft.Screens;

namespace MiniCraft
{
    /// <summary>
    /// This is the main type for your game.
    /// </summary>
    public class MCGame : Game
    {
        private const long serialVersionUID = 1L;
        private Random random = new Random();
        public const string NAME = "Minicraft";
        public const int HEIGHT = 120 ;
        public const int WIDTH = 160 ;
        public const int SCALE = 4;

        private Texture2D image;
        private Color[] pixels;
        private bool running = false;
        private Screen screen;
        private Screen lightScreen;
        private InputHandler input;

        private Color[] colors;
        private int tickCount;
        public int gameTime = 0;

        private Level level;
        private Level[] levels = new Level[5];
        private int currentLevel = 3;
        public Player player;

        public Menu menu;
        private int playerDeadTime;
        private int pendingLevelChange;
        private int wonTimer = 0;
        public bool hasWon = false;


        private GraphicsDeviceManager graphics;
        private SpriteBatch spriteBatch;

        public bool hasFocus() { return this.IsActive; }

        public void setMenu(Menu menu)
        {
            this.menu = menu;
            if (menu != null) menu.init(this, input);
        }

        public MCGame()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferHeight = HEIGHT * SCALE;
            graphics.PreferredBackBufferWidth = WIDTH * SCALE;

            Content.RootDirectory = "Content";
        }

        protected override void OnExiting(object sender, EventArgs args)
        {
            running = false;
            base.OnExiting(sender, args);
        }

        public void resetGame()
        {

            playerDeadTime = 0;
            wonTimer = 0;
            gameTime = 0;
            hasWon = false;

            levels = new Level[5];
            currentLevel = 3;

            levels[4] = new Level(128, 128, 1, null);
            levels[3] = new Level(128, 128, 0, levels[4]);
            levels[2] = new Level(128, 128, -1, levels[3]);
            levels[1] = new Level(128, 128, -2, levels[2]);
            levels[0] = new Level(128, 128, -3, levels[1]);

            level = levels[currentLevel];
            player = new Player(this, input);
            player.findStartPos(level);

            level.add(player);

            for (int i = 0; i < 5; i++)
            {
                levels[i].trySpawn(5000);
            }
        }

        protected override void LoadContent()
        {
            running = true;

            var pp = 0;
            colors = new Color[256];

            for (int r = 0; r < 6; r++)
            {
                for (int g = 0; g < 6; g++)
                {
                    for (int b = 0; b < 6; b++)
                    {
                        int rr = (r * 255 / 5);
                        int gg = (g * 255 / 5);
                        int bb = (b * 255 / 5);
                        int mid = (rr * 30 + gg * 59 + bb * 11) / 100;

                        int r1 = ((rr + mid * 1) / 2) * 230 / 255 + 10;
                        int g1 = ((gg + mid * 1) / 2) * 230 / 255 + 10;
                        int b1 = ((bb + mid * 1) / 2) * 230 / 255 + 10;
                        colors[pp++] = new Color(r1, g1, b1);
                    }
                }
            }

            while (pp < 256)
            {
                colors[pp++] = Color.Black;
            }

            var spriteSheet = Content.Load<Texture2D>("Textures/icons");
            screen = new Screen(WIDTH, HEIGHT, new SpriteSheet(spriteSheet));
            lightScreen = new Screen(WIDTH, HEIGHT, new SpriteSheet(spriteSheet));

            Sounds.Sound.Initialize(this.Content);
            spriteBatch = new SpriteBatch(GraphicsDevice);

            pixels = new Color[WIDTH * HEIGHT];
            image = new Texture2D(GraphicsDevice, WIDTH, HEIGHT);
            input = new InputHandler();

            resetGame();
            setMenu(new TitleMenu());

        }<commit_msg>removed unneeded code<commit_after>﻿using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MiniCraft.Entities;
using MiniCraft.Gfx;
using MiniCraft.Levels;
using MiniCraft.Levels.Tiles;
using MiniCraft.Screens;

namespace MiniCraft
{
    /// <summary>
    /// This is the main type for your game.
    /// </summary>
    public class MCGame : Game
    {
        private const long serialVersionUID = 1L;
        private Random random = new Random();
        public const string NAME = "Minicraft";
        public const int HEIGHT = 120 ;
        public const int WIDTH = 160 ;
        public const int SCALE = 4;

        private Texture2D image;
        private Color[] pixels;
        private bool running = false;
        private Screen screen;
        private Screen lightScreen;
        private InputHandler input;

        private Color[] colors;
        private int tickCount;
        public int gameTime = 0;

        private Level level;
        private Level[] levels = new Level[5];
        private int currentLevel = 3;
        public Player player;

        public Menu menu;
        private int playerDeadTime;
        private int pendingLevelChange;
        private int wonTimer = 0;
        public bool hasWon = false;


        private GraphicsDeviceManager graphics;
        private SpriteBatch spriteBatch;

        public bool hasFocus() { return this.IsActive; }

        public void setMenu(Menu menu)
        {
            this.menu = menu;
            if (menu != null) menu.init(this, input);
        }

        public MCGame()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferHeight = HEIGHT * SCALE;
            graphics.PreferredBackBufferWidth = WIDTH * SCALE;

            Content.RootDirectory = "Content";
        }

        protected override void OnExiting(object sender, EventArgs args)
        {
            running = false;
            base.OnExiting(sender, args);
        }

        public void resetGame()
        {

            playerDeadTime = 0;
            wonTimer = 0;
            gameTime = 0;
            hasWon = false;

            levels = new Level[5];
            currentLevel = 3;

            levels[4] = new Level(128, 128, 1, null);
            levels[3] = new Level(128, 128, 0, levels[4]);
            levels[2] = new Level(128, 128, -1, levels[3]);
            levels[1] = new Level(128, 128, -2, levels[2]);
            levels[0] = new Level(128, 128, -3, levels[1]);

            level = levels[currentLevel];
            player = new Player(this, input);
            player.findStartPos(level);

            level.add(player);

            for (int i = 0; i < 5; i++)
            {
                levels[i].trySpawn(5000);
            }
        }

        protected override void LoadContent()
        {
            running = true;

            var pp = 0;
            colors = new Color[256];

            for (int r = 0; r < 6; r++)
            {
                for (int g = 0; g < 6; g++)
                {
                    for (int b = 0; b < 6; b++)
                    {
                        int rr = (r * 255 / 5);
                        int gg = (g * 255 / 5);
                        int bb = (b * 255 / 5);
                        int mid = (rr * 30 + gg * 59 + bb * 11) / 100;

                        int r1 = ((rr + mid * 1) / 2) * 230 / 255 + 10;
                        int g1 = ((gg + mid * 1) / 2) * 230 / 255 + 10;
                        int b1 = ((bb + mid * 1) / 2) * 230 / 255 + 10;
                        colors[pp++] = new Color(r1, g1, b1);
                    }
                }
            }

            //while (pp < 256)
            //{
            //    colors[pp++] = Color.Black;
            //}

            var spriteSheet = Content.Load<Texture2D>("Textures/icons");
            screen = new Screen(WIDTH, HEIGHT, new SpriteSheet(spriteSheet));
            lightScreen = new Screen(WIDTH, HEIGHT, new SpriteSheet(spriteSheet));

            Sounds.Sound.Initialize(this.Content);
            spriteBatch = new SpriteBatch(GraphicsDevice);

            pixels = new Color[WIDTH * HEIGHT];
            image = new Texture2D(GraphicsDevice, WIDTH, HEIGHT);
            input = new InputHandler();

            resetGame();
            setMenu(new TitleMenu());

        }
{'fraction_non_alphanumeric': 0.10178817056396149, 'fraction_numerical': 0.03209536909674461, 'mean_word_length': 1.4310392867093897, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4396862', 'n_tokens_mistral': 2637, 'n_tokens_neox': 2316, 'n_words': 720}