コード例 #1
0
        public void Start()
        {
            Console.CursorVisible = false;
            string[,] sizeOfTown  = new string[25, 100]; // Världen

            ThisWorld = new World(sizeOfTown);

            for (int i = 0; i <= 10; i++) // Lägga till T [Samma för de två for loopar där nere fast för P och M]
            {
                thief = new Thief(placement.Next(0, 100), placement.Next(0, 25));
                thieves.Add(thief);
            }

            for (int i = 0; i <= 20; i++)
            {
                police = new Police(placement.Next(0, 100), placement.Next(0, 25));
                polices.Add(police);
            }

            for (int i = 0; i <= 30; i++)
            {
                pedestrian = new Pedestrian(placement.Next(0, 100), placement.Next(0, 25));
                pedestrians.Add(pedestrian);
            }



            RunLoop();
        }
コード例 #2
0
ファイル: City.cs プロジェクト: jorfus/TjuvOchPolis
        public City(int column, int row, int citizens, int police, int thieves)
        {
            TheCity = new char[row, column];

            for (row = 0; row <= TheCity.GetUpperBound(0); row++)
            {
                for (column = 0; column <= TheCity.GetUpperBound(1); column++)
                {
                    TheCity[row, column] = ' ';
                }
            }

            Person person;

            for (int i = 1; i <= citizens; i++)
            {
                person = new Citizen(this, ThePersonList, false);
                ThePersonList.Add(person);
            }
            for (int i = 1; i <= police; i++)
            {
                person = new Police(this, ThePersonList);
                ThePersonList.Add(person);
            }
            for (int i = 1; i <= thieves; i++)
            {
                person = new Thief(this, ThePersonList);
                ThePersonList.Add(person);
            }

            PlacePersons();
        }