コード例 #1
0
ファイル: Program.cs プロジェクト: SzymonMurawski/DSA_2020
        static void Main(string[] args)
        {
            GoLGrid gameGrid = new GoLGrid();

            gameGrid.InitializeRandomly();
            while (true)
            {
                System.Threading.Thread.Sleep(1000);
                gameGrid.Display();
                gameGrid.Transform();
            }
        }
コード例 #2
0
        // Lorsque la fenêtre est chargée, on crée une nouvelle grille, et on s’abonne à son évènement de mise à jour.
        void MainWindow_Loaded(object _sender, RoutedEventArgs _e)
        {
            grid = new GoLGrid((int)gridCanvas.ActualWidth / 3, (int)gridCanvas.ActualHeight / 3, 0.1);
            grid.gridUpdatedEvent += grid_gridUpdatedEvent;

            // On crée aussi un timer qui se lancera toutes les 500ms.
            updateTimer          = new DispatcherTimer();
            updateTimer.Tick    += updateTimer_Tick;
            updateTimer.Interval = new TimeSpan(0, 0, 0, 0, 500);

            // On lance la simulation.
            updateTimer.Start();
            running = true;
        }