<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Noises;
using OctoAwesome.Model.Blocks;

namespace OctoAwesome.Model
{
    public sealed class ChunkManager
    {

        public List<Chunk> Chunks { get; private set; }
        public INoise NoiseGenerator { get; private set; }

        public ChunkManager(INoise noiseGenerator)
        {
            this.NoiseGenerator = noiseGenerator;     

            Chunks = new List<Chunk>();

            for (int x = -5; x < 5; x++)
            {
                for (int z = -5; z < 5; z++)
                {
                    Chunks.Add(new Chunk(x, 0, z) { Blocks = CreateChunk(x, 0, z) });
                }
            }

        }

        public IBlock[, ,] CreateChunk(int chunkX, int chunkY, int chunkZ)
        {

            IBlock[, ,] blocks = new IBlock[Chunk.CHUNKSIZE_X, Chunk.CHUNKSIZE_Y, Chunk.CHUNKSIZE_Z];

            float[, ,] noise = NoiseGenerator.GetNoise3(chunkX, chunkY, chunkZ, Chunk.CHUNKSIZE_X, Chunk.CHUNKSIZE_Y, Chunk.CHUNKSIZE_Z);

            for (int y = 0; y < Chunk.CHUNKSIZE_Y; y++)
            {
                float min_noise = (float)Math.Cos((((double)y * Math.PI) / 50d) + Math.PI);
               // min_noise = 0f;

                for (int x = 0; x < Chunk.CHUNKSIZE_X; x++)
                {
                    for (int z = 0; z < Chunk.CHUNKSIZE_Z; z++)
                    {
                    
                             if ((noise[x, y, z]) > min_noise)
                            blocks[x, y, z] = new GrassBlock();
                        //else if ((noise[x, y, z] / 2) < 0.2f)
                        //    blocks[x, y, z] = new GrassBlock();
                    }
                }
            }


            return blocks;
        }<commit_msg>Check in für Aufnahme<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Noises;
using OctoAwesome.Model.Blocks;

namespace OctoAwesome.Model
{
    public sealed class ChunkManager
    {

        public List<Chunk> Chunks { get; private set; }
        public INoise NoiseGenerator { get; private set; }

        public ChunkManager(INoise noiseGenerator)
        {
            this.NoiseGenerator = noiseGenerator;     

            Chunks = new List<Chunk>();

            for (int x = -2; x < 2; x++)
            {
                for (int z = -2; z < 2; z++)
                {
                    Chunks.Add(new Chunk(x, 0, z) { Blocks = CreateChunk(x, 0, z) });
                }
            }

        }

        public IBlock[, ,] CreateChunk(int chunkX, int chunkY, int chunkZ)
        {

            IBlock[, ,] blocks = new IBlock[Chunk.CHUNKSIZE_X, Chunk.CHUNKSIZE_Y, Chunk.CHUNKSIZE_Z];

            float[, ,] noise = NoiseGenerator.GetNoise3(chunkX, chunkY, chunkZ, Chunk.CHUNKSIZE_X, Chunk.CHUNKSIZE_Y, Chunk.CHUNKSIZE_Z);

            for (int y = 0; y < Chunk.CHUNKSIZE_Y; y++)
            {
                double min_noise = Math.Cos(((y / 50f) * Math.PI) + Math.PI);

                for (int x = 0; x < Chunk.CHUNKSIZE_X; x++)
                {
                    for (int z = 0; z < Chunk.CHUNKSIZE_Z; z++)
                    {

                        if (y < 2)
                        {
                            blocks[x, y, z] = new SandBlock();
                            continue;
                        }
                        if ((noise[x, y, z]) > 0) blocks[x, y, z] = new GrassBlock();
                    }
                }
            }


            return blocks;
        }
{'fraction_non_alphanumeric': 0.11507383672332126, 'fraction_numerical': 0.008358874338255782, 'mean_word_length': 1.3131443298969072, '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': '2014577', 'n_tokens_mistral': 1172, 'n_tokens_neox': 1085, 'n_words': 268}