示例#1
0
        private void SeatEater(int id, bool whatever)
        {
            Party.Philosophers[id] = new Philosopher(id)
            {
                LeftChopstick  = Chopsticks[GetLeftChopstick(id)],
                RightChopstick = Chopsticks[GetRightChopstick(id)],
                Satisfaction   = 0,
                HungerLevel    = 25
            };

            if (whatever)
            {
                Party.Philosophers[id].EatFromTable += RightHandedEaterGetsFood;
            }
            else
            {
                Party.Philosophers[id].EatFromTable += LeftHandedEaterGetsFood;
            }
            OnFoodArives += Party.Philosophers[id].EatFoodUntillFull;
            Party.Philosophers[id].myTable = this;
        }
示例#2
0
        private void SeatEater(int id, bool whatever)
        {
            Party.Philosophers[id] = new Philosopher(id)
            {
                LeftChopstick = Chopsticks[GetLeftChopstick(id)],
                RightChopstick = Chopsticks[GetRightChopstick(id)],
                Satisfaction = 0,
                HungerLevel = 25
            };

            if (whatever)
            {
                Party.Philosophers[id].EatFromTable += RightHandedEaterGetsFood;
            }
            else
            {
                Party.Philosophers[id].EatFromTable += LeftHandedEaterGetsFood;
            }
            OnFoodArives += Party.Philosophers[id].EatFoodUntillFull;
            Party.Philosophers[id].myTable = this;

        }