Versionsvergleich
Aus ProgrammingWiki
Vergleich: 2016-06-09T07:13:32+00:00 → 2016-06-09T08:36:12+00:00
<language>Javascript</language> | |
'''Test Gebiet Turtle Quadrat ''' | |
ZEICHENFELD = Canvas | |
Wir brauchen den Code für zeichen eins Quadrates | |
<canvas width=800 height=800></canvas> | |
| − | <code id="574feef9d6e2a"> |
| − | function quadrat(x) { |
| − | for(var i = 0; i<4) |
| − | { turtle.forward(x) ; turtle.right(90) ; } turtle.forward(x) ; turtle.right(90) ; turtle.forward(x) ; turtle.right(90) ; turtle.forward(x); turtle.right(90) ;} |
| − | </code> |
| − | <code id="5759171b900ce"> |
| + | |
| + | <code id="57592a7c38d60"> |
| + | function quadrat(x) |
| + | { turtle.forward(x) ; turtle.right(90) ; turtle.forward(x) ; turtle.right(90) ; turtle.forward(x) ; turtle.right(90) ; turtle.forward(x); turtle.right(90) ;} |
| + | |
function rechteck(a,b) { turtle.forward(b) ; turtle.right(90) ; turtle.forward(a) ; turtle.right(90) ; turtle.forward(a) ; turtle.right(90) ; turtle.forward(a) ; turtle.right(90) ;} | |
| − | </code> |
| − | <code id="5759171b9013f"> |
function dreieck(a) { | |
turtle.forward(a) ; | |
turtle.right(120) ; | |
turtle.forward(a) ; | |
turtle.right(120) ; | |
turtle.forward(a) ; | |
turtle.right(120); | |
} | |
| − | </code> |
| − | <code id="5759171b901a3"> |
function haus(a) { | |
quadrat(a); | |
turtle.forward(a); | |
| − | turtle.right(90) |
| − | turtle.forward(a) |
| + | turtle.right(90) ; |
| + | turtle.forward(a) ; |
turtle.right(180); | |
dreieck(a); | |
} | |
| + | function auto_q (a) { |
| + | for(i = 1; i < 5; i++ ) |
| + | { turtle.forward(a); turtle.right(90); } |
| + | } |
| + | function drehqzwanzig (a) { |
| + | for(j = 1; j < 40; j++ ) |
| + | {auto_q (a) ; turtle.right (10) ; } |
| + | } |
</code> | |
| − | |
| − | <code id="5759171b90205"> |
| − | function quadratauto(x) { |
| − | for(var i = 0; i<4; i++) |
| − | { turtle.forward(x) ; turtle.right(90) ; } |
| − | </code> |
| − | |
| − | <run id="5759171b90277"> |
| + | <run id="57592a7c38dcb"> |
var c = new Canvas(1); | |
c.clear(); | |
| − | turtle.home() ; |
| − | quadratauto(40); |
| − | quadratauto(60); |
| − | quadrat(80); |
| + | turtle.home() ; |
| + | turtle.right(180); |
| + | turtle.forward(50); |
| + | dreh.q.zwanzig (500); |
</run> |