-
Notifications
You must be signed in to change notification settings - Fork 2
/
simple.html
51 lines (44 loc) · 1.59 KB
/
simple.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<html><head>
<script type="text/javascript" src="./lib/jquery.js"></script>
<script type="text/javascript" src="./lib/raphael.js"></script>
<script type="text/javascript" src="./lib/Base.js"></script>
<script type="text/javascript" src="./lib/Utility.js"></script>
<script type="text/javascript" src="./lib/World.js"></script>
<script type="text/javascript" src="./lib/Sprite.js"></script>
<script type="text/javascript" src="./lib/Turtle.js"></script>
</head><body>
<table id="grid" style="width: 500px;
height: 500px;">
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
<tr><td></td><td></td><td></td></tr>
</table>
<script type="text/javascript">
var world;
window.onload = function() {
world = new World("table#grid")
world.addTurtle(0, 0, "green");
world.addTurtle(world.numCols()-1,
world.numRows()/2,
"#d05");
var green = world.turtles[0];
green.pushQueue("fwd");
green.pushQueue("fwd");
green.pushQueue("penup");
green.pushQueue("fwd");
var blue = world.turtles[1];
blue.setOrientation(0,-1);
blue.pushQueue("left");
blue.pushQueue("fwd");
blue.pushQueue("right");
blue.pushQueue("fwd");
blue.pushQueue("paint");
blue.pushQueue("color red");
blue.pushQueue("fwd");
blue.pushQueue("paint");
blue.pushQueue("back");
world.run();
};
</script>
</body></html>