예제 #1
0
        static void Main(string[] args)
        {
            // [Length(row number), Width(column number)]
            int[,] initialWorld = new int[15, 17] {
                                                    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                                                    {0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0},
                                                    {0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0},
                                                    {0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0},
                                                    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                                                    {0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},
                                                    {0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},
                                                    {0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},
                                                    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                                                    {0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0},
                                                    {0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0},
                                                    {0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},
                                                    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                                                    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                                                    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
            };

            var world = new World(initialWorld);

            for (var i = 0; i < 500; i++)
            {
                world.Evolve();

                //var tmp = world.ToString();
                Console.SetCursorPosition(0, 0);
                Console.Write(world.ToString());
                System.Threading.Thread.Sleep(200);
            }

            Console.Read();
        }