Skip to content

Commit 418118b

Browse files
docs: Adding Turtles All The Way Down to README ( Fixes #206 )
Adding InscribedCircle example
1 parent 649f141 commit 418118b

File tree

3 files changed

+74
-2
lines changed

3 files changed

+74
-2
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<#
2+
.SYNOPSIS
3+
An inscribed circle
4+
.DESCRIPTION
5+
A simple example of turtles containing turtles
6+
#>
7+
$inscribedCircle =
8+
turtle width 42 height 42 turtles @{
9+
'square' = turtle square 42 fill '#4488ff' stroke '#224488'
10+
'circle' = turtle circle 21 fill '#224488' stroke '#4488ff'
11+
}
12+
13+
$inscribedCircle | Save-Turtle ./InscribedCircle.svg
14+
$inscribedCircle | Save-Turtle ./InscribedCirclePattern.svg Pattern

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,34 @@ We call this 'Turtles All The Way Down', and it lets us do two very important se
295295
* It allows turtles to interact
296296
* It allows us to model the behavior of multiple turtles
297297

298-
Let's start with a couple of cool practical examples.
298+
Let's start with a few cool examples.
299+
300+
At the most basic, let's make an inscribed circle and square:
301+
302+
~~~PowerShell
303+
.SYNOPSIS
304+
An inscribed circle
305+
.DESCRIPTION
306+
A simple example of turtles containing turtles
307+
#>
308+
$inscribedCircle =
309+
turtle width 42 height 42 turtles @{
310+
'square' = turtle square 42 fill '#4488ff' stroke '#224488'
311+
'circle' = turtle circle 21 fill '#224488' stroke '#4488ff'
312+
}
313+
314+
$inscribedCircle | Save-Turtle ./InscribedCircle.svg
315+
$inscribedCircle | Save-Turtle ./InscribedCirclePattern.svg Pattern
316+
~~~
317+
318+
<div align='center'>
319+
<img src='./Examples/InscribedCircle.svg' alt='Inscribed Circle' width='100%' />
320+
</div>
321+
Let's see it as a pattern:
322+
<div align='center'>
323+
<img src='./Examples/InscribedCirclePattern.svg' alt='Inscribed Circle Pattern' width='100%' height='50%' />
324+
</div>
325+
#### Behavior Modelling
299326

300327
Imagine we are four turtles in a square, each trying to catch up with the next turtle.
301328

README.md.ps1

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,38 @@ We call this 'Turtles All The Way Down', and it lets us do two very important se
408408
* It allows turtles to interact
409409
* It allows us to model the behavior of multiple turtles
410410
411-
Let's start with a couple of cool practical examples.
411+
Let's start with a few cool examples.
412+
413+
At the most basic, let's make an inscribed circle and square:
414+
415+
~~~PowerShell
416+
$(
417+
@(Get-Content ./Examples/InscribedCircle.turtle.ps1 |
418+
Select-Object -Skip 1) -join [Environment]::NewLine
419+
)
420+
~~~
421+
422+
"@
423+
424+
@"
425+
<div align='center'>
426+
<img src='./Examples/InscribedCircle.svg' alt='Inscribed Circle' width='100%' />
427+
</div>
428+
"@
429+
430+
@"
431+
Let's see it as a pattern:
432+
"@
433+
434+
@"
435+
<div align='center'>
436+
<img src='./Examples/InscribedCirclePattern.svg' alt='Inscribed Circle Pattern' width='100%' height='50%' />
437+
</div>
438+
"@
439+
440+
441+
@"
442+
#### Behavior Modelling
412443
413444
Imagine we are four turtles in a square, each trying to catch up with the next turtle.
414445

0 commit comments

Comments
 (0)