private void FindNinjas(char[,] inputMatrix, string ninja1Name, string ninja2Name)
        {
            var ninja1Initial = ninja1Name[0];
            var ninja2Initial = ninja2Name[0];

            var rows = inputMatrix.GetLength(0);
            var cols = inputMatrix.GetLength(1);

            for (int row = 0; row < rows; row++)
            {
                for (int col = 0; col < cols; col++)
                {
                    var currentChar = inputMatrix[row, col];

                    if (currentChar == ninja1Initial)
                    {
                        if (this.ninja1 == null)
                        {
                            this.ninja1 = new Ninja(ninja1Name, row, col);

                            // this.field.FieldOfNinjaMovement[row, col] = ninja1Initial;

                            // Console.WriteLine("ninja 1 is " + ninja1.Name);
                        }
                        else if (this.ninja2 == null)
                        {
                            this.ninja2 = new Ninja(ninja1Name, row, col);

                            // this.field.FieldOfNinjaMovement[row, col] = ninja1Initial;

                            // Console.WriteLine("ninja 2 is " + ninja2.Name);
                        }
                    }

                    if (currentChar == ninja2Initial)
                    {
                        if (this.ninja1 == null)
                        {
                            this.ninja1 = new Ninja(ninja2Name, row, col);

                            // this.field.FieldOfNinjaMovement[row, col] = ninja2Initial;

                            // Console.WriteLine("ninja 1 is " + ninja1.Name);
                        }
                        else if (this.ninja2 == null)
                        {
                            this.ninja2 = new Ninja(ninja2Name, row, col);

                            // this.field.FieldOfNinjaMovement[row, col] = ninja2Initial;

                            // Console.WriteLine("ninja 2 is " + ninja2.Name);
                        }
                    }
                }
            }
        }
        private void ProcessNinjaTurn(Ninja currentNinja, StringBuilder commands, ref int currentCommandIndex)
        {
            // Console.WriteLine("______________________");
            // Console.WriteLine($"{currentNinja.Name}'s turn");
            do
            {
                this.ProcessCommand(commands[currentCommandIndex], currentNinja);
                currentCommandIndex = IncrementCommandIndex(commands, currentCommandIndex);
            }
            while (currentNinja.Stamina != 0);

            currentNinja.EatCollectedVeggies();
        }
        private void NinjaBattle(Ninja ninja, Ninja otherNinja)
        {
            Ninja winner;

            if (ninja.Power >= otherNinja.Power)
            {
                winner = ninja;
            }
            else
            {
                winner = otherNinja;
            }

            this.Writer.WriteLine($"Winner: {winner}");
            this.Writer.WriteLine($"Power: {winner.Power}");
            this.Writer.WriteLine($"Stamina: {winner.Stamina}");

            Environment.Exit(0);
        }
 private void ProcessCommand(char command, Ninja currentNinja)
 {
     switch (command)
     {
         case 'L':
             // Console.WriteLine($"{currentNinja.Name} moved left");
             this.MoveNinja(currentNinja, 0, -1);
             break;
         case 'R':
             // Console.WriteLine($"{currentNinja.Name} moved right");
             this.MoveNinja(currentNinja, 0, 1);
             break;
         case 'U':
             // Console.WriteLine($"{currentNinja.Name} moved up");
             this.MoveNinja(currentNinja, -1, 0);
             break;
         case 'D':
             // Console.WriteLine($"{currentNinja.Name} moved down");
             this.MoveNinja(currentNinja, 1, 0);
             break;
     }
 }
        private void MoveNinja(Ninja currentNinja, int deltaX, int deltaY)
        {
            var movedPosition = new Position(currentNinja.Position.X + deltaX, currentNinja.Position.Y + deltaY);

            currentNinja.Stamina--;

            // bump into wall
            var bumpsIntoHorizontalWall = movedPosition.X < 0 || movedPosition.X > this.field.GetLength(0) - 1;
            var bumpsIntoVerticalWall = movedPosition.Y < 0 || movedPosition.Y > this.field.GetLength(1) - 1;

            if (bumpsIntoHorizontalWall || bumpsIntoVerticalWall)
            {
                // Console.WriteLine($"{currentNinja.Name} bumped into a wall");
                // Console.WriteLine($"{currentNinja.Name}: P: {currentNinja.Power} S: {currentNinja.Stamina}");

                return;
            }

            // step on vegetable
            currentNinja.Position = new Position(movedPosition.X, movedPosition.Y);

            // step on enemy
            var ninjasAreStandingInTheSameSpot =
                this.ninja1.Position.X == this.ninja2.Position.X &&
                this.ninja1.Position.Y == this.ninja2.Position.Y;

            if (ninjasAreStandingInTheSameSpot)
            {
                NinjaBattle(this.ninja1, this.ninja2);
            }

            var vegetableAtPosition = this.field[movedPosition.X, movedPosition.Y];
            if (!vegetableAtPosition.HasBeenCollected)
            {
                currentNinja.CollectVegetable(vegetableAtPosition);
                // Console.WriteLine($"{currentNinja.Name} collected {vegetableAtPosition.GetType().Name}.");
            }

            // Console.WriteLine($"{currentNinja.Name}: P: {currentNinja.Power} S: {currentNinja.Stamina}");
        }