示例#1
0
        static void Main(string[] args)
        {
            RandomPool.Declare("envset", 0);
            //RandomPool.Get();


            NetworkGenerator generator = new WSmodelNetworkGenerator(100, 8, 0.12);

            generator.NodeCreate += () => new Node();
            //          =  generator.NodeCreate += createNode;
            Network net = generator.create();

            //Console.WriteLine(net);

            //NetworkGenerator generator2 = new LeaderNetworkGenerator(100, 8, 0.12, 30);
            //環境を作る
            //generator2.NodeCreate += () => new Node();
            //Network leaderNet = generator2.create();
            //double c = LeaderNetworkGenerator.cluster(leaderNet.Nodes.ElementAt(0),leaderNet);
            //Console.WriteLine(leaderNet);

            for (int i = 0; i < net.Nodes.Count(); i++)
            {
                double C = WSmodelNetworkGenerator.cluster(net.Nodes.ElementAt(i), net);
                Console.Write("clusters{0} = ", i);
                Console.WriteLine(+C);
            }
        }
示例#2
0
        public BlackWhiteSubject newData()
        {
            BlackWhiteSubject currentData;
            double            r = RandomPool.Get("sensor").NextDouble();


            if (r < accuracy)//正しいデータ
            {
                currentData = theFact.Value;
            }

            else //間違ったデータ
            {
                if (theFact.Value == BlackWhiteSubject.Black)//天邪鬼if
                {
                    currentData = BlackWhiteSubject.White;
                }
                else
                {
                    currentData = BlackWhiteSubject.Black;
                }
            }

            //知らせる
            SendOpinion(currentData, agent);

            return(currentData);
        }
示例#3
0
 public void PlaySteps(int steps, int playstep_seed)
 {
     RandomPool.Declare(SeedEnum.PlayStepSeed, playstep_seed);
     for (int i = 0; i < steps; i++)
     {
         this.MyAlgo.PlayOneStep(this.MyNetwork, this.MyAgentSet, InfoEnum.Green, InfoEnum.Red);
     }
 }
示例#4
0
        public I_Agent Generate(I_Node node, InfoEnum init_op, double g_sigma, double r_sigma, AgentInitMode mode)
        {
            var node_id          = node.NodeID;
            var init_weight_list = new Dictionary <int, double>();

            foreach (var neighbor in node.NeighborNodeIDList)
            {
                init_weight_list.Add(neighbor, 1.0);
            }
            double init_belief = 0;

            var ir = RandomPool.Get(SeedEnum.AgentSeed);

            switch (mode)
            {
            case AgentInitMode.Random:
                init_belief = ir.NextDouble(r_sigma, g_sigma);
                break;

            case AgentInitMode.RandomWeakPulledByOpinion:
                if (init_op == InfoEnum.Green)
                {
                    init_belief = ir.NextDouble(0.5, g_sigma);
                }
                else
                {
                    init_belief = ir.NextDouble(r_sigma, 0.5);
                }
                break;

            case AgentInitMode.RandomStrongPulledByOpinion:
                if (init_op == InfoEnum.Green)
                {
                    init_belief = ir.NextDouble(g_sigma, 1.0);
                }
                else
                {
                    init_belief = ir.NextDouble(0, r_sigma);
                }
                break;

            case AgentInitMode.Normal:
                init_belief = ir.NextNormal(0.5, 0.1);
                break;

            case AgentInitMode.NormalWeakPulledByOpinion:
                break;

            case AgentInitMode.NormalStrongPulledByOpinion:
                break;

            default:
                break;
            }
            return(new BaseAgent(node_id, init_belief, init_weight_list, init_op, g_sigma, r_sigma));
        }
示例#5
0
        /// <summary>
        /// Applies this operator.
        /// </summary>
        public bool Apply(TSProblem problem, TSPObjective objective, Tour solution, out float delta)
        {
            if (problem.Weights.Length <= 2)
            {
                delta = 0;
                return(false);
            }

            var before        = objective.Calculate(problem, solution);
            var weights       = problem.Weights;
            var turnPenalties = problem.TurnPenalties;

            delta = 0;

            // test switching directions in random order.
            if (_pool == null || solution.Count != _pool.Size)
            { // create a new pool.
                _pool = new RandomPool(solution.Count);
            }
            else
            { // just reset the existing one.
                _pool.Reset();
            }

            var i        = _n;
            var toInsert = new List <int>();

            while (_pool.MoveNext() && i > 0)
            {
                i--;
                var currentId = _pool.Current;
                var current   = solution.GetDirectedId(currentId);
                if (current != Constants.NOT_SET)
                {
                    if (current != solution.First &&
                        current != solution.Last &&
                        solution.Remove(current))
                    {
                        toInsert.Add(current);
                    }
                }
            }

            foreach (var current in toInsert)
            {
                CheapestInsertionDirectedHelper.InsertCheapestDirected(solution, weights, turnPenalties,
                                                                       DirectedHelper.ExtractId(current));
            }

            var after = objective.Calculate(problem, solution);

            delta = after - before;
            return(delta < 0);
        }
示例#6
0
        public I_AgentSet Generate(int agent_seed, AgentInitMode mode)
        {
            List <I_Agent> agent_list = new List <I_Agent>();

            RandomPool.Declare(SeedEnum.AgentSeed, agent_seed);
            foreach (var node in this.MyNetwork.NodeList)
            {
                var agent = new AgentFactory().Generate(node, this.InitOpinion, this.GreenSigma, this.RedSigma, mode);
                agent_list.Add(agent);
            }
            return(new BaseAgentSet(agent_list, agent_seed));
        }
示例#7
0
        public void Can_serialize_RandomPoolWithDispatcherAndResizer()
        {
            var defaultResizer = new DefaultResizer(2, 4, 1, 0.5, 0.4, 0.1, 55);
            var message        = new RandomPool(
                nrOfInstances: 25,
                routerDispatcher: "my-dispatcher",
                usePoolDispatcher: true,
                resizer: defaultResizer,
                supervisorStrategy: SupervisorStrategy.DefaultStrategy);

            AssertEqual(message);
        }
示例#8
0
        public void SetSensors(int num, double sensor_acc)
        {
            this.SensorNum = num;
            this.SensorAcc = sensor_acc;

            var ir = RandomPool.Get(SeedEnum.AgentSeed);

            var list = this.AgentList.Select(agent => agent.NodeID).OrderBy(id => ir.Next()).Take(num)
                       .ToList();

            this.AgentList.Where(agent => list.Contains(agent.NodeID)).ToList().ForEach(agent => agent.SetSensor(true, sensor_acc));
        }
        public void CanSerializeRandomPool()
        {
            var decider = Decider.From(
             Directive.Restart,
             Directive.Stop.When<ArgumentException>(),
             Directive.Stop.When<NullReferenceException>());

            var supervisor = new OneForOneStrategy(decider);

            var message = new RandomPool(10, new DefaultResizer(0, 1), supervisor, "abc");
            AssertEqual(message);
        }
示例#10
0
        public void randomNext()
        {
            double r = RandomPool.Get("fact").NextDouble();

            if (r < 0.5)
            {
                Value = BlackWhiteSubject.White;
            }
            else
            {
                Value = BlackWhiteSubject.Black;
            }
        }
示例#11
0
        public IActionResult RandomAlcoholPoolSummary()
        {
            List <RandomPool> _summary = new List <RandomPool>();

            RandomPool entry = new RandomPool
            {
                Random_Test_Selection_Date = DateTime.Now,
                Batch_Number            = 108,
                Active_Enrolled_Drivers = 545,
                Selected_Drivers        = 235,
                Excused_Drivers         = 15,
                Positive_Tested_Drivers = 13,
                Negative_Tested_Drivers = 200,
                Selection_Test_Ratio    = .10,
                Annual_Ratio            = .15
            };

            _summary.Add(entry);

            RandomPool entry2 = new RandomPool
            {
                Random_Test_Selection_Date = DateTime.Now.AddDays(-365),
                Batch_Number            = 11,
                Active_Enrolled_Drivers = 333,
                Selected_Drivers        = 111,
                Excused_Drivers         = 15,
                Positive_Tested_Drivers = 13,
                Negative_Tested_Drivers = 200,
                Selection_Test_Ratio    = .09,
                Annual_Ratio            = .22
            };

            _summary.Add(entry2);

            RandomPool entry3 = new RandomPool
            {
                Random_Test_Selection_Date = DateTime.Now.AddDays(-800),
                Batch_Number            = 10,
                Active_Enrolled_Drivers = 444,
                Selected_Drivers        = 222,
                Excused_Drivers         = 15,
                Positive_Tested_Drivers = 13,
                Negative_Tested_Drivers = 200,
                Selection_Test_Ratio    = .11,
                Annual_Ratio            = .13
            };

            _summary.Add(entry3);

            return(View(_summary));
        }
示例#12
0
        static void Main(string[] args)
        {
            const int ElementCount = 52;
            int[] aInts = new int[ElementCount];

            // init a list with  1 - 52
            List<int> lInts = new List<int>();
            for (int i = 1; i <= ElementCount; i++)
            {
                lInts.Add(i);
            }

            // test
            while (true)
            {
                RandomPool<int> intPool = new RandomPool<int>(lInts);
                int aIntsIndex = 0;
                for (int i = 0; i < lInts.Count; i++)
                {
                    aInts[aIntsIndex] = intPool.GetLeftItem();
                    ++aIntsIndex;
                }

                // display
                Console.WriteLine();
                Console.WriteLine("----------Result----------");
                foreach (var item in aInts)
                {
                    Console.Write(item + ",");
                }
                Console.WriteLine();

                // test right
                Console.WriteLine("----------Sort to check----------");
                Array.Sort(aInts);
                foreach (var item in aInts)
                {
                    Console.Write(item + ",");
                }
                Console.WriteLine();

                // continue
                Console.WriteLine("----------Test Again ? Y/N----------");
                string s = Console.ReadLine();
                if (s.ToLower() == "n")
                {
                    break;
                }
            }
        }
示例#13
0
        public I_Network Generate(int network_seed, bool seed_enable)
        {
            RandomPool.Declare(SeedEnum.LayoutSeed, network_seed);
            var state = 0;

            switch (state)
            {
            case 0:
                Console.WriteLine("-----");
                Console.WriteLine("ok Start Network Generation");
                var delete_success = ConvertNetwork.DeleteNetworkOutput();
                if (!delete_success)
                {
                    goto default;
                }

                var python_success = this.RawGenerate(network_seed, seed_enable);
                if (!python_success)
                {
                    goto default;
                }

                var raw_edge_list = ConvertNetwork.GetRawEdgeList();
                var node_num      = ConvertNetwork.GetRawNodeNum();
                var network_enum  = this.MyNetworkEnum;
                if (raw_edge_list == null || node_num == 0 || network_enum == NetworkEnum.Void)
                {
                    goto default;
                }

                Console.WriteLine("ok Load Raw Network");
                Console.WriteLine("ok Node: " + node_num);
                Console.WriteLine("ok Edge: " + raw_edge_list.Count);
                Console.WriteLine("ok NetworkEnum: " + network_enum.ToString());
                Console.WriteLine("ok Network Seed: " + network_seed);
                var network = new NetworkFactory().Generate(node_num, raw_edge_list, network_enum, network_seed);
                if (network == null)
                {
                    goto default;
                }

                Console.WriteLine("ok Success Network Generation");
                return(network);

            default:
                Console.WriteLine("no Failure Network Generation");
                return(null);
            }
        }
示例#14
0
        public void Run()
        {
            this.MakeFileAndFolder();

            RandomPool.Declare(SeedEnum.RoundSeed, this.RoundSeed);
            RandomPool.Declare(SeedEnum.PlayStepSeed, this.RoundSeed);

            Console.WriteLine(this.PrintObject());
            this.MyAlgo.MyOSMLog.StartRecordRounds(this.OutputRoundFilePath);
            for (int current_round = 1; current_round <= this.TotalRounds; current_round++)
            {
                this.MyAlgo.RunOneRound(this.MyNetwork, this.MyAgentSet, current_round, this.RoundSteps);
            }
            this.MyAlgo.MyOSMLog.StopRecordRounds();
        }
        public IEnumerable <Link> SelectLinksToRewire(IEnumerable <Link> links)
        {
            int linksNum  = links.Count();
            int rewireNum = (int)(p_rewire * linksNum);

            IEnumerable <int> selectedIndex = RandomPool.Get("envset").getRandomIndexes(linksNum, rewireNum);

            List <Link> selectedLinks = new List <Link>();

            foreach (var index in selectedIndex)
            {
                selectedLinks.Add(links.ElementAt(index));
            }

            return(selectedLinks);
        }
示例#16
0
        public void StartRound(int?seed = null)
        {
            //ラウンドの数字を進める
            Round++;

            //ステップははじめにもどす
            Step = 0;

            //何も渡されなければ、ラウンドIDをシードにする。
            if (seed == null)
            {
                seed = Round;
            }

            RandomPool.Declare("sensor", seed.Value);
        }
示例#17
0
    public void initializePoolFromCSV(string csv, EPoolType poolType)
    {
        switch (poolType)
        {
        case EPoolType.NORMAL:
            lettersPool = new RandomPool <ABCChar>(getLettersInfoFromCSV(csv));
            break;

        case EPoolType.OBSTACLE:
            obstaclesLettersPool = new RandomPool <ABCChar>(getLettersInfoFromCSV(csv));
            break;

        case EPoolType.TUTORIAL:
            tutorialLettersPool = new RandomPool <ABCChar>(getLettersInfoFromCSV(csv));
            break;
        }
    }
示例#18
0
    public List <T> PickN(int n, bool allowDuplicates = true)
    {
        List <T>       ret   = new List <T>();
        RandomPool <T> clone = this.Clone(this);

        for (int i = 0; i < n; i++)
        {
            T pickedValue = clone.PickOne();
            ret.Add(pickedValue);
            if (!allowDuplicates)
            {
                clone.RemoveValue(pickedValue);
            }
        }

        return(ret);
    }
示例#19
0
        public override Network create()
        {
            Console.WriteLine("make random network!");
            //ネットワーク
            Network net = new Network();

            //ノードであるAgent
            for (int i = 0; i < NodeNum; i++)
            {
                net.AddNode(NodeCreate());//エージェントを選択可能にしたいよね
            }

            foreach (var Node_i in net.Nodes)
            {
                foreach (var Node_j in net.Nodes)
                {
                    if (Node_i == Node_j)
                    {
                        break;
                    }

                    double r = RandomPool.Get("envset").NextDouble();


                    if (r < 0.3)
                    { //0.3の確率でコネクション作成
                        net.ConnectNode(Node_i, Node_j);
                    }
                }

                var nodes = net.Nodes;
                if (Node_i.Neighbours.Count() == 0)
                {
                    int r;
                    do
                    {
                        r = RandomPool.Get("envset").Next(NodeNum);
                    } while (nodes.ElementAt(r) == Node_i);

                    net.ConnectNode(Node_i, nodes.ElementAt(r));
                }
            }
            //まだ!!
            return(net);
        }
示例#20
0
        private void PrepareSensor(int sensorNum)
        {
            //センサー
            Sensors = new List <Sensor>();

            //センサーをもつエージェントを決める
            var selectedIndexes = RandomPool.Get("setenv").getRandomIndexes(this.Network.Nodes.Count(), sensorNum);

            foreach (var i in selectedIndexes)
            {
                //センサーを生成
                Sensor s = new Sensor(TheFact);

                //センサーにエージェントをセット(内部でAgentのhavesensorをtrueにしてる.微妙に密結合)
                s.SetAgent((Agent)this.Network.Nodes.ElementAt(i));
                this.Sensors.Add(s);
            }
        }
示例#21
0
        /// <summary>
        /// Solves the given problem.
        /// </summary>
        /// <returns></returns>
        public sealed override Tour Solve(STSProblem problem, STSPObjective objective, out STSPFitness fitness)
        {
            // generate random pool to select customers from.
            if (_randomPool == null || _randomPool.Size < problem.Weights.Length)
            {
                _randomPool = new RandomPool(problem.Weights.Length);
            }
            else
            {
                _randomPool.Reset();
            }

            // keep adding customers until no more space is left or no more customers available.
            var tour = problem.CreateEmptyTour();

            fitness = new STSPFitness()
            {
                Weight    = 0,
                Customers = 1
            };
            while (_randomPool.MoveNext())
            {
                var customer = _randomPool.Current;
                if (customer == problem.First ||
                    customer == problem.Last)
                {
                    continue;
                }

                Pair location;
                var  cost = CheapestInsertionHelper.CalculateCheapest(tour, problem.Weights, customer, out location);
                if (cost + fitness.Weight < problem.Max)
                {
                    tour.InsertAfter(location.From, customer);

                    fitness.Weight    = fitness.Weight + cost;
                    fitness.Customers = fitness.Customers + 1;
                }
            }

            // calculate fitness.
            fitness = objective.Calculate(problem, tour);
            return(tour);
        }
示例#22
0
        /// <summary>
        /// Solves the given problem.
        /// </summary>
        /// <returns></returns>
        public sealed override Tour Solve(STSProblem problem, STSPObjective objective, out STSPFitness fitness)
        {
            // generate empty route based on problem definition.
            var route = problem.CreateEmptyTour();

            fitness = new STSPFitness()
            {
                Weight    = 0,
                Customers = 1
            };

            // generate random pool to select customers from.
            if (_randomPool == null || _randomPool.Size < problem.Weights.Length)
            {
                _randomPool = new RandomPool(problem.Weights.Length / 2);
            }
            else
            {
                _randomPool.Reset();
            }

            // keep adding customers until no more space is left or no more customers available.
            while (_randomPool.MoveNext())
            {
                var customer = _randomPool.Current;
                if (customer == DirectedHelper.ExtractId(route.First) ||
                    (route.Last.HasValue && customer == DirectedHelper.ExtractId(route.Last.Value)))
                { // customer is first or last.
                    continue;
                }

                var cost = CheapestInsertionDirectedHelper.InsertCheapestDirected(route, problem.Weights, problem.TurnPenalties,
                                                                                  customer, problem.Max - fitness.Weight);
                if (cost > 0)
                {
                    fitness.Customers++;
                    fitness.Weight += cost;
                }
            }

            // calculate fitness.
            fitness = objective.Calculate(problem, route);
            return(route);
        }
示例#23
0
        public void Test5()
        {
            var shuffle = new RandomPool(5);
            var list    = new List <int>();
            var current = shuffle.GetNext();

            while (current >= 0)
            {
                list.Add(current);
                current = shuffle.GetNext();
            }

            Assert.AreEqual(5, list.Count);
            Assert.Contains(0, list);
            Assert.Contains(1, list);
            Assert.Contains(2, list);
            Assert.Contains(3, list);
            Assert.Contains(4, list);
        }
示例#24
0
        //センサーエージェントは、センサーの値を観測
        private void SensorObservation()
        {
            //*** 10%のセンサーが新しい値を取得する.***

            int sensorNum = Environment.Sensors.Count;

            int observationNum = (int)(Math.Ceiling(sensorNum * 0.1));

            var indexes = RandomPool.Get("sensor").getRandomIndexes(sensorNum, observationNum);

            //L.g("sensor").Write("");
            foreach (int index in indexes)
            {
                Sensor s    = Environment.Sensors.ElementAt(index);
                var    data = s.newData();

                //   L.g("sensor").Write("s->" + s.Agent.ID + " " +  ( data == BlackWhiteSubject.White ? 1 : -1 ) + ", ");
            }
            //L.g("sensor").WriteLine("");
        }
示例#25
0
        void SendEnvMessage(I_Network network, I_AgentSet agent_set, InfoEnum correct, InfoEnum incorrect, double op_intro_rate)
        {
            this.OpinionIntroCounts++;
            if (this.OpinionIntroCounts < this.OpinionIntroductionDuration)
            {
                return;
            }

            this.OpinionIntroCounts = 0;
            this.EnvOpinionCounts++;

            var correct_opinion   = correct;
            var incorrect_opinion = incorrect;

            foreach (var agent in agent_set.AgentList)
            {
                if (!(agent.IsSensor))
                {
                    continue;
                }
                if (RandomPool.Get(SeedEnum.PlayStepSeed).NextDouble() > op_intro_rate)
                {
                    continue;
                }

                var env_info = InfoEnum.Undeter;
                if (RandomPool.Get(SeedEnum.PlayStepSeed).NextDouble() < agent.SensorAccuracy)
                {
                    env_info = correct_opinion;
                }
                else
                {
                    env_info = incorrect_opinion;
                }

                this.SendMessageQueue.Enqueue(new Message(-1, agent.NodeID, env_info));
            }
        }
示例#26
0
        private INode RuletSelect(IEnumerable <INode> nodes)
        {
            int sum = 0;
            int cum = 0;

            double r = RandomPool.Get("envset").NextDouble();

            foreach (var node in nodes)
            {
                sum += node.Neighbours.Count;
            }

            foreach (var node in nodes)
            {
                cum += node.Neighbours.Count;
                if (r < (double)cum / sum)
                {
                    return(node);
                }
            }

            throw new Exception("何が起こった!?");
        }
示例#27
0
        static public AgentAlgorithm CreateAlgorithm(string name, double h_trg)
        {
            IAATBasedAgent algo = creators[name]();

            //信念など
            if (algo is SubOpinion) //今はまだ場合分けが少ないからいいけどいずれはFactory Methodになるかも。
            {
                algo.Thought = new ThoughtTwin(RandomPool.Get("envset").NextNormal(0.5, 0.1));
            }
            else
            {
                algo.Thought = new Thought(RandomPool.Get("envset").NextNormal(0.5, 0.1));
            }

            //候補集合
            algo.CandidateSelector = new CandidateUpdaterSelector();

            algo.TargetAwarenessRate = h_trg;

            //最後に初期化
            algo.Initialize();

            return(algo as AgentAlgorithm);
        }
示例#28
0
        public void Can_serialize_RandomPool()
        {
            var message = new RandomPool(nrOfInstances: 25);

            AssertEqual(message);
        }
 //
 // RandomPool
 //
 private byte[] RandomPoolToProto(RandomPool randomPool)
 {
     return(GenericRoutingPoolBuilder(randomPool).ToByteArray());
 }
示例#30
0
    public RandomPool <T> Clone(RandomPool <T> other)
    {
        RandomPool <T> newPool = new RandomPool <T>(new List <ValueWeight <T> >(other.pool));

        return(newPool);
    }
示例#31
0
 public void SetSensorSeed(int s)
 {
     RandomPool.Declare("sensor", s);//ちゃんとinitEnvでseedの設定してるよ
 }
示例#32
0
        static void Main(string[] args)
        {
            string[] values = { "AWOTOT", "BOAJBO", "HNZNHL", "ISTOES",
                                "TSDIYT", "PSCAOH", "TYTLRE", "ERXIDL",
                                "FAAFPK", "QuUIHNM", "SNEIUE", "AEANGE",
                                "RVTWEN", "TMUOIC", "WEENGH", "LYVRDE"};

            while (true)
            {

                #region get all random letters
                List<string> randoms = new List<string>();
                Random random = new Random();
                for (int i = 0; i < values.Length; i++)
                {
                    int index = random.Next(0, 6);
                    string dice = values[i].Substring(index, 1);
                    if (i == 9)
                    {
                        if (index == 0)
                        {
                            dice = "Qu";
                        }
                        else
                        {
                            dice = values[i].Substring(index + 1, 1);
                        }
                    }
                    randoms.Add(dice);
                }
                #endregion

                #region randomly throw into grid 4 * 4
                RandomPool<string> pool = new RandomPool<string>(randoms);
                string[,] boggle44 = new string[4, 4];
                for (int i = 0; i < 4; i++)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        boggle44[i, j] = pool.GetLeftItem();
                    }
                }
                #endregion

                #region use special test case ???
                Console.WriteLine("---------------------------\r\nUse Special Test Case ? Y/N");
                string ra = Console.ReadLine();
                if (ra.ToLower().Contains("y"))
                {
                    boggle44[0, 0] = "S";
                    boggle44[0, 1] = "R";
                    boggle44[0, 2] = "E";
                    boggle44[0, 3] = "L";

                    boggle44[1, 0] = "T";
                    boggle44[1, 1] = "V";
                    boggle44[1, 2] = "R";
                    boggle44[1, 3] = "H";

                    boggle44[2, 0] = "S";
                    boggle44[2, 1] = "O";
                    boggle44[2, 2] = "A";
                    boggle44[2, 3] = "H";

                    boggle44[3, 0] = "J";
                    boggle44[3, 1] = "D";
                    boggle44[3, 2] = "S";
                    boggle44[3, 3] = "N";
                }
                #endregion

                #region print test case
                Console.WriteLine("Test Case: ");
                for (int i = 0; i < 4; i++)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        Console.Write(boggle44[i, j] + " ");
                    }
                    Console.WriteLine();
                }
                #endregion

                #region run with 4*4 boggle
                var watch = Stopwatch.StartNew();
                BoggleHandler boggle = new BoggleHandler(new BoggleGrid(boggle44, 4, 4));
                IEnumerable<string> s = boggle.GetAllEnWords();
                watch.Stop();
                #endregion

                #region print result
                Console.WriteLine("---------------------------------------------");
                Console.WriteLine("\r\n Result: " + s.Count() + " Words");
                foreach (var item in s)
                {
                    Console.WriteLine(item);
                }
                Console.WriteLine();
                Console.WriteLine("Time Eclipsed: " + watch.ElapsedMilliseconds + " milliseconds");
                #endregion

                #region exit or not

                Console.WriteLine("---------------------------\r\nTest Again? Y/N");
                string exit = Console.ReadLine();
                if (exit.ToLower().Contains("n"))
                {
                    break;
                }
                #endregion
            }
        }