

from __future__ import annotations

import matplotlib.pyplot as plt  # type: ignore
import numpy

# initial triangle of Koch snowflake
lowerCamelCase           =					numpy.array([0, 0])
lowerCamelCase           =					numpy.array([0.5, 0.8660254])
lowerCamelCase           =					numpy.array([1, 0])
lowerCamelCase           =					[VECTOR_1, VECTOR_2, VECTOR_3, VECTOR_1]




def 			UpperCAmelCase__				(			_A      : list[numpy.ndarray]	,      _A      : int							):





  '''simple docstring'''







  a__  =initial_vectors
  for _ in range(_lowerCamelCase							):
    a__  =iteration_step(_lowerCamelCase							)
  return vectors




def 			UpperCAmelCase__				(			_A      : list[numpy.ndarray]							):





  '''simple docstring'''







  a__  =[]
  for i, start_vector in enumerate(vectors[:-1]							):
    a__  =vectors[i + 1]
    new_vectors.append(_lowerCamelCase							)
    a__  =end_vector - start_vector
    new_vectors.append(start_vector + difference_vector / 3							)
    new_vectors.append(
        start_vector + difference_vector / 3 + rotate(difference_vector / 3	,      60							)							)
    new_vectors.append(start_vector + difference_vector * 2 / 3							)
  new_vectors.append(vectors[-1]							)
  return new_vectors




def 			UpperCAmelCase__				(			_A      : numpy.ndarray	,      _A      : float							):





  '''simple docstring'''







  a__  =numpy.radians(_lowerCamelCase							)
  a__  =numpy.cos(_lowerCamelCase							), numpy.sin(_lowerCamelCase							)
  a__  =numpy.array(((c, -s), (s, c))							)
  return numpy.dot(_lowerCamelCase	,      _lowerCamelCase							)




def 			UpperCAmelCase__				(			_A      : list[numpy.ndarray]							):





  '''simple docstring'''







  a__  =plt.gca()
  axes.set_aspect('''equal'''							)

  # matplotlib.pyplot.plot takes a list of all x-coordinates and a list of all
  # y-coordinates as inputs, which are constructed from the vector-list using
  # zip()
  a__  =zip(*_lowerCamelCase							)
  plt.plot(_lowerCamelCase	,      _lowerCamelCase							)
  plt.show()


if __name__ == "__main__":
       import doctest

       doctest.testmod()

       lowerCamelCase           =					iterate(INITIAL_VECTORS, 5)
       plot(processed_vectors)





'''simple docstring'''




from __future__ import annotations


def 				lowerCAmelCase_   (	_lowerCamelCase:   list[int]					):
		if not nums:
				return 0
		__SCREAMING_SNAKE_CASE       :		Optional[int]           =		nums[0]
		__SCREAMING_SNAKE_CASE       :		Union[str, Any]           =		0
		for num in nums[1:]:
				__SCREAMING_SNAKE_CASE       ,						__SCREAMING_SNAKE_CASE       :		Any           =		(
				    max_excluding + num,
				    max(_lowerCamelCase       ,      _lowerCamelCase					),
				)
		return max(_lowerCamelCase       ,      _lowerCamelCase					)


if __name__ == "__main__":
						import doctest

						doctest.testmod()