-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
65 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html> | ||
<html lang="zh"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="author" content="Gaolei He"> | ||
<meta name="description" content="how to setup nginx on your server"> | ||
<title>Koch curve</title> | ||
</head> | ||
|
||
<body> | ||
<h1><a href="https://zh.wikipedia.org/wiki/%E7%A7%91%E8%B5%AB%E6%9B%B2%E7%B7%9A">雪花曲线</a></h1> | ||
|
||
<hr> | ||
<i>Code</i> | ||
<p><table cellPadding=10px><tr><td><font color="#000000"><font face="monospace"> | ||
<pre> | ||
# 用Python在本地跑 | ||
import turtle | ||
|
||
|
||
def snow(n, size): | ||
if n == 0: | ||
turtle.fd(size) | ||
return | ||
for angle in [0, 60, -120, 60]: | ||
turtle.left(angle) | ||
snow(n - 1, size / 3) | ||
|
||
|
||
# 输入n表示雪花曲线级数 | ||
# 设为[1,4]即可,数值太大效果不好 | ||
n = 3 | ||
|
||
turtle.setup(1920, 1080) | ||
turtle.speed(1000) | ||
turtle.penup() | ||
turtle.goto(-300, 300) | ||
turtle.pendown() | ||
turtle.pensize(1) | ||
|
||
for angle in [0, 120, 120]: | ||
turtle.right(angle) | ||
snow(n, 600) | ||
|
||
turtle.done() | ||
</pre> | ||
</font></font></td></tr></table></p> | ||
|
||
<hr> | ||
|
||
<footer> | ||
<p>Copyright © <a href="https://github.com/gaolei-he">Gaolei He</a></p> | ||
</footer> | ||
</body> | ||
|
||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters