fromarray.py
544 B · python · 26 lines
1import mrlypy.two as m22import numpy as np34def from_list():5 python_list = [6 [0, 1, 1],7 [1, 0, 1],8 [1, 1, 0]9 ]10 cell = m2.Cell2d.from_list(python_list)11 cell = cell.fractal(2).paint()12 cell.to_image(scale=10).show()1314def from_array():15 numpy_array = np.array([16 [0, 1, 1],17 [1, 0, 1],18 [1, 1, 0]19 ])20 cell = m2.Cell2d.from_array(numpy_array)21 cell = cell.fractal(3).paint()22 cell.to_image(scale=10).show()2324if __name__ == "__main__":25 from_list()26 from_array()