Game AI & Unity/L-system algorithm 25

[Plants and Python][prac3] 해바라기 만들기1

Activity 3: How to Build a Sunflower 🌻 In this activity, you will learn how to code the intricate, beautiful packing of florets in a sunflower head, explore the sensitivity of the arrangement of florets to the golden angle, and create animations of a growing sunflower. Your reading assignment before this activity is "Chapter 4 - Phyllotaxis" from The Algorithmic Beauty of Plants. The inspiration..

[Plants and Python][prac2] 피보나치 수열, 패턴 출력

식물은 어떤 특정한 패턴을 가지고 있다. 특히, 해바라기의 경우 피보나치 수열의 패턴을 계속 반복한다. 여기에서는 loop를 사용해서 이러한 패턴을 출력해보려고 한다. Practice with Calculating the Golden Angle with Loops 🌻 From the Fibonacci sequence to the Golden Ratio After watching the video tutorial, in the cell below, create a for loop that calculates the first 100 numbers of the Fibonacci sequence. Do the following: Remember to create a list outside your for lo..

[Plants and Python][prac1] 잎사귀 데이터를 가지고, 실제 모양 출력해보기

# Plants & Python # The shape of data, the shape of leaves # Visualiing data using matplotlib import numpy as np import matplotlib.pyplot as plt 더보기 # This cell contains lists of x values and y values for # leaf outlines of 15 Vitis and Ampelopsis species. # Each list has the abbreviated first initial of the genus and species epithet x = [0]*16 y = [0]*16 # Ampelopsis acoutifolia x[0] = [13.8119..

[Plants and Python][lec7] L-system의 원리, 시아노 박테리아 cell structure

L-system은 시아노 박테리아를 연구하는 도중에 나온 개념이다. 시아노 박테리아의 cell type이 2가지가 있기 때문에, L-system 에서도 2가지를 factor로 사용한다. axiom = 'ABBA' rules = {'A':'AB', 'B':'A'} ''.join(rules.get(c,c) for c in axiom) A 대신 AB를 넣고, B대신 A를 넣는 것이다. 즉, ABBA는 ABAAAB가 된다. axiom = 'ABBA' rules = {'A':'AB', 'B':'A'} def single_transform(axiom, rules): return ''.join(rules.get(c,c) for c in axiom) var = single_transform(axiom, rules) p..

[Plants and Python][lec6] Dictionary practice using Genetic Materials

1. 기본적인 연습 더보기 # Plants & Python, vol. 7: Functions, Dictionaries, and L-Systems genetic_code = {'TTT':'Phenylalanine','TTC':'Phenylalanine','TTA':'Leucine','TTG':'Leucine','CTT':'Leucine','CTC':'Leucine','CTA':'Leucine','CTG':'Leucine','ATT':'Isoleucine','ATC':'Isoleucine','ATA':'Isoleucine','ATG':'Methionine','GTT':'Valine','GTC':'Valine','GTA':'Valine','GTG':'Valine','TCT':'Serine','TCC':'Ser..

[Plants and Python][lec4] Random number generators

1. random.random() import random import matplotlib.pyplot as plt %matplotlib inline random.random() import random import matplotlib.pyplot as plt %matplotlib inline random.random() random_list = [] for i in range(1000000): n = random.random() random_list.append(n) plt.hist(random_list, bins=30) * 히스토그램 표로 되어 있는 도수 분포를 정보 그림으로 나타낸 것 2. random.shuffle() * 참고 https://www.youtube.com/watch?v=w2DZU3W..

[Plants and Python][lec3] Loops and the Fibonacci Sequence

1. for문 이용 fibonacci = [0,1] for i in range(2,10): two_previous = fibonacci[i-2] one_previous = fibonacci[i-1] new_value = two_previous + one_previous fibonacci.append(new_value) print(fibonacci) print(len(fibonacci)) 2. while문 이용 fibonacci = [0,1] counter = 0 while counter < 25: i = counter + 2 fibonacci.append(fibonacci[i-2] + fibonacci[i-1]) counter += 1 print(len(fibonacci)) print(fibonacci)..