gampu / Von-Koch-Snowflake

A simple example of generating von koch snowflakes using recursion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Von-Koch-Snowflake

A simple example of generating von koch snowflakes using recursion

Build Status

Purpose

The purpose of this effort is to get familiar with:

  • Generating von koch snowflakes using recursion
  • Building and testing the code on travis

Example Output

example

How does it work?

  • Lines 24-26 specify that we intend to create snowflakes along the borders of a triangle. This justify's the usage of right( 120 ) on line 26.
  • Each call to the solve function, breaks the given line of length len into 4 parts, each of length len/4. The four parts are drawn in a manner that represent: _/\_. This justifies the usage of turning commands on lines 13, 15 and 17 which turn the turtle to the left by 60 °, to the right by 120 ° and again to the left by 60 ° respectively.
  • The above step is performed recursively except for the base case, in which, we simply draw a straight line.

About

A simple example of generating von koch snowflakes using recursion

License:MIT License


Languages

Language:Python 100.0%