public Environment(GraphicalView view, int x = 10, int y = 10)
        {
            _caseX = x;
            _caseY = y;
            rooms  = new Room[x, y];

            _view = view;
            for (int i = 0; i < NbCaseX; i++)
            {
                for (int j = 0; j < NbCaseY; j++)
                {
                    rooms[i, j] = new Room();
                }
            }
            _view.FormClosing += EndGame;
        }
Example #2
0
        public static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Thread agentThread, environmentThread;

            int           x           = 10;
            int           y           = 10;
            GraphicalView view        = new GraphicalView(x, y);
            Environment   environment = new Environment(view, x, y);

            environment.ChanceDirt    = 30;
            environment.ChanceJewelry = 10;
            environment.FactorSleep   = 100;

            Agent agent = new Agent(environment);

            agentThread       = new Thread(agent.AsyncWork);
            environmentThread = new Thread(environment.AsyncTask);
            agentThread.Start();
            environmentThread.Start();

            Application.Run(view);
        }