





from __future__ import annotations

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

# initial triangle of Koch snowflake
__UpperCAmelCase							=   numpy.array([0, 0])
__UpperCAmelCase							=   numpy.array([0.5, 0.866_0254])
__UpperCAmelCase							=   numpy.array([1, 0])
__UpperCAmelCase							=   [VECTOR_1, VECTOR_2, VECTOR_3, VECTOR_1]
def       __UpperCamelCase					(      lowercase__						:							list[numpy.ndarray]		,     lowercase__						:							int		)						->   list[numpy.ndarray]:
    '''simple docstring'''





    lowerCAmelCase_       :						Dict							= initial_vectors
    for _ in range(UpperCamelCase_		):
        lowerCAmelCase_       :						Dict							= iteration_step(UpperCamelCase_		)
    return vectors
def       __UpperCamelCase					(      lowercase__						:							list[numpy.ndarray]		)						->   list[numpy.ndarray]:
    '''simple docstring'''





    lowerCAmelCase_       :						Any							= []
    for i, start_vector in enumerate(vectors[:-1]		):
        lowerCAmelCase_       :						List[Any]							= vectors[i + 1]
        new_vectors.append(UpperCamelCase_		)
        lowerCAmelCase_       :						int							= 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					(      lowercase__						:							numpy.ndarray		,     lowercase__						:							float		)						->   numpy.ndarray:
    '''simple docstring'''





    lowerCAmelCase_       :						Any							= numpy.radians(UpperCamelCase_		)
    lowerCAmelCase_		,		lowerCAmelCase_       :						List[str]							= numpy.cos(UpperCamelCase_		), numpy.sin(UpperCamelCase_		)
    lowerCAmelCase_       :						Tuple							= numpy.array(((c, -s), (s, c))		)
    return numpy.dot(UpperCamelCase_		,     UpperCamelCase_		)
def       __UpperCamelCase					(      lowercase__						:							list[numpy.ndarray]		)						->   None:
    '''simple docstring'''





    lowerCAmelCase_       :						List[Any]							= 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()
    lowerCAmelCase_		,		lowerCAmelCase_       :						Optional[int]							= zip(*UpperCamelCase_		)
    plt.plot(UpperCamelCase_		,     UpperCamelCase_		)
    plt.show()


if __name__ == "__main__":
  import doctest

  doctest.testmod()

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







'''simple docstring'''

import os

SCREAMING_SNAKE_CASE__     :						Optional[Any]	=  {'''I''': 1, '''V''': 5, '''X''': 1_0, '''L''': 5_0, '''C''': 1_0_0, '''D''': 5_0_0, '''M''': 1_0_0_0}






def 				a  (     UpperCamelCase_    :    str			)       ->	int:
		snake_case__	     =0

		snake_case__	     =0
		while index < len(UpperCamelCase_			) - 1:
				snake_case__	     =SYMBOLS[numerals[index]]
				snake_case__	     =SYMBOLS[numerals[index + 1]]
				if current_value < next_value:
						total_value -= current_value
				else:
						total_value += current_value
				index += 1
		total_value += SYMBOLS[numerals[index]]

		return total_value






def 				a  (     UpperCamelCase_    :    int			)       ->	str:
		snake_case__	     =''

		snake_case__	     =num // 1000
		numerals += m_count * "M"
		num %= 1000

		snake_case__	     =num // 100
		if c_count == 9:
				numerals += "CM"
				c_count -= 9
		elif c_count == 4:
				numerals += "CD"
				c_count -= 4
		if c_count >= 5:
				numerals += "D"
				c_count -= 5
		numerals += c_count * "C"
		num %= 100

		snake_case__	     =num // 10
		if x_count == 9:
				numerals += "XC"
				x_count -= 9
		elif x_count == 4:
				numerals += "XL"
				x_count -= 4
		if x_count >= 5:
				numerals += "L"
				x_count -= 5
		numerals += x_count * "X"
		num %= 10

		if num == 9:
				numerals += "IX"
				num -= 9
		elif num == 4:
				numerals += "IV"
				num -= 4
		if num >= 5:
				numerals += "V"
				num -= 5
		numerals += num * "I"

		return numerals






def 				a  (     UpperCamelCase_    :    str = "/p089_roman.txt"			)       ->	int:
		snake_case__	     =0

		with open(os.path.dirname(UpperCamelCase_			) + roman_numerals_filename			) as filea:
				snake_case__	     =filea.readlines()

		for line in lines:
				snake_case__	     =line.strip()
				snake_case__	     =parse_roman_numerals(UpperCamelCase_			)
				snake_case__	     =generate_roman_numerals(UpperCamelCase_			)
				savings += len(UpperCamelCase_			) - len(UpperCamelCase_			)

		return savings


if __name__ == "__main__":
			print(f"""{solution() = }""")




