Turn() public method

public Turn ( FoodMatrix eatMatrix, Membrane creatures ) : DirectionEnum>.Tuple
eatMatrix CellsAutomate.Food.FoodMatrix
creatures Membrane
return DirectionEnum>.Tuple
Esempio n. 1
0
        private void MakeTurn(Membrane currentCreature)
        {
            try
            {
                var turnResult = currentCreature.Turn(EatMatrix, Creatures);
                var action     = turnResult.Item1;
                var direction  = turnResult.Item2;

                switch (action)
                {
                case ActionEnum.Die:
                    MakeTurnDie(currentCreature.Position); break;

                case ActionEnum.MakeChild:
                    MakeTurnMakeChild(direction, currentCreature); break;

                case ActionEnum.Go:
                    MakeTurnGo(direction, currentCreature); break;

                case ActionEnum.Eat:
                    currentCreature.Eat(EatMatrix); break;

                default: throw new Exception();
                }
            }
            catch (Exception)
            {
                MakeTurnDie(currentCreature.Position);
                EXCEPTIONS++;
            }
        }
Esempio n. 2
0
        private void MakeTurn(Membrane currentCreature)
        {
            try
            {
                var turnResult = currentCreature.Turn(EatMatrix, Creatures);
                var action = turnResult.Item1;
                var direction = turnResult.Item2;

                switch (action)
                {
                    case ActionEnum.Die:
                        MakeTurnDie(currentCreature.Position); break;
                    case ActionEnum.MakeChild:
                        MakeTurnMakeChild(direction, currentCreature); break;
                    case ActionEnum.Go:
                        MakeTurnGo(direction, currentCreature); break;
                    case ActionEnum.Eat:
                        currentCreature.Eat(EatMatrix); break;
                    default: throw new Exception();
                }
            }
            catch (Exception)
            {
                MakeTurnDie(currentCreature.Position);
                EXCEPTIONS++;
            }
        }