public Timer(BayesForm bForm)
        {
            bform = bForm;
            setUpBnet();
            // seting up the environment with standard objects
            sizeX = EnvironmentMap.sizeX;
            sizeY = EnvironmentMap.sizeY;
            int X = 0;
            int Y = 0;
            Random rand = new Random(System.DateTime.Now.Millisecond);
            double water;
            double mountain;
            double plant;
            double animal;
            counter.Add("water", 0);
            counter.Add("fish", 0);
            counter.Add("shark", 0);
            counter.Add("ground", 0);
            counter.Add("mountain", 0);
            counter.Add("tree", 0);
            counter.Add("rabbit", 0);
            counter.Add("jackal", 0);
            counter.Add("wolf", 0);
            counter.Add("Cave", 0);
            counter.Add("Agent", 0);
            counter.Add("House", 0);
            counter.Add("garden", 0);
            counter.Add("woodmill", 0);
            counter.Add("dam", 0);

            while (X < sizeX)
            {
                while (Y < sizeY)
                {
                    water = rand.NextDouble();
                    if (water < chanceForWater)
                    {
                        EnvironmentMap.add(new water(bnet), X, Y);
                        animal = rand.NextDouble();
                        if (animal < chanceForFish)
                            EnvironmentMap.add(new fish(bnet), X, Y);
                        animal = rand.NextDouble();
                        if (animal < chanceForShark)
                            EnvironmentMap.add(new shark(bnet), X, Y);
                    }
                    else
                    {
                        mountain = rand.NextDouble();
                        if (mountain < chanceForMountain)
                        {
                            EnvironmentMap.add(new mountain(bnet), X, Y);
                            animal = rand.NextDouble();
                            if (animal < chanceForWolf)
                                EnvironmentMap.add(new wolf(bnet), X, Y);
                            mountain = rand.NextDouble();
                            if (mountain < chanceForCave)
                            {
                                animal = rand.NextDouble();
                                Cave cave = new Cave(bnet);
                                if (animal < chanceForAgent)
                                {
                                    EnvironmentMap.add(new Agent(bnet, cave), X, Y);
                                    EnvironmentMap.add(new Agent(bnet, cave), X, Y);
                                    EnvironmentMap.add(new Agent(bnet, cave), X, Y);
                                }
                                EnvironmentMap.add(cave, X, Y);
                            }
                        }
                        else
                        {
                            EnvironmentMap.add(new ground(bnet), X, Y);
                            plant = rand.NextDouble();
                            if (plant < chanceForTree)
                            {
                                animal = rand.NextDouble();
                                if (animal < chanceForRabbit)
                                    EnvironmentMap.add(new rabbit(bnet), X, Y);
                                EnvironmentMap.add(new tree(bnet), X, Y);
                            }
                            else
                            {
                                animal = rand.NextDouble();
                                if (animal < chanceForJackal)
                                    EnvironmentMap.add(new jackal(bnet), X, Y);
                            }
                        }
                    }
                    ++Y;
                }
                Y = 0;
                ++X;
            }

            EnvironmentMap.update(counter);
            EnvironmentMap.update(counter);
            /*
            //starting infinite loop

            int turncounter = 50;
            int show = 10;
            while (true)
            {
                ++year;
                bnet.updateFull();
                clearCounter(counter);

                EnvironmentMap.update(counter);
                if (turncounter >= show)
                {
                    turncounter = 0;
                    bform.Refresh();
                    /*
                    Console.WriteLine("\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
                    Console.WriteLine("Counter :");
                    foreach (KeyValuePair<string, int> C in counter)
                    {
                        if (C.Key.Equals("Cave"))
                            Console.WriteLine("\nAgent Related Information\n");
                        Console.WriteLine(C.Key + " = " + C.Value);
                    }
                    Console.WriteLine("\n");
                    Console.WriteLine("Year : " + year);
                    Console.WriteLine("BayesNet :\n");
                    //Console.WriteLine("Nodes:\n" + bnet.Nodes.toString());
                    EnvironmentMap.toString();
                    *
                }
                ++turncounter;
                //Console.ReadKey();
            }
             */
        }
        static void Main(string[] args)
        {
            //testNetAsGraph();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            bform = new BayesForm();
        }