コード例 #1
0
        public GenerateCosmology(int seed)
        {
            Grammar = new Grammar(10000)
            {
                StartSymbol  = 'X',
                NonTerminals = new List <char>()
                {
                    'F', 'P', 'D'
                },
                Terminals = new List <char>()
                {
                    'f', 'p', 'd'
                },

                ProductionRules = new List <ProductionRule>()
                {
                    new ProductionRule('X', "xF", 100),
                    new ProductionRule('X', "xFF", 50),
                    new ProductionRule('X', "xFFF", 10),

                    new ProductionRule('F', "FF", 100),
                    new ProductionRule('F', "FFF", 50),
                    new ProductionRule('F', "FFFF", 10),

                    new ProductionRule('F', "fp", 50, true),
                    new ProductionRule('F', "fd", 50, true),
                },

                Result = "X"
            };

            Cosmology = new Cosmology();
            Random    = new Random(seed);
        }
コード例 #2
0
ファイル: Cosmic.cs プロジェクト: joshkempner/Cosmic.NET
        private void Cosmic_Load(object sender, EventArgs e)
        {
            errorProvider1 = new ErrorProvider();
            cosmology      = new Cosmology();

            // initialize the cosmology
            HubbleConstant.Text = cosmology.H0.ToString();
            OmegaMatter.Text    = cosmology.OmegaMatter.ToString();
            OmegaLambda.Text    = cosmology.OmegaLambda.ToString();

            // set a default redshift
            Redshift.Text      = "0.1";
            cosmology.Redshift = Convert.ToDouble(Redshift.Text);
        }