feed_bo 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/lib/.DS_Store +0 -0
- data/lib/assets/images/robot.svg +170 -0
- data/lib/feed_bo/cookie.rb +5 -3
- data/lib/feed_bo/drawable.rb +2 -0
- data/lib/feed_bo/element.rb +2 -2
- data/lib/feed_bo/level.rb +9 -10
- data/lib/feed_bo/robot.rb +46 -84
- data/lib/feed_bo/tool.rb +10 -0
- data/lib/feed_bo/touch_sensor.rb +16 -0
- data/lib/feed_bo/version.rb +1 -1
- data/lib/feed_bo/wall.rb +3 -2
- data/lib/feed_bo.rb +3 -1
- metadata +5 -3
- data/lib/feed_bo/balloon.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 583964656d0229bec8daa8ab893b7ae6849dd4ca
|
4
|
+
data.tar.gz: 4cafff412a9ac41a05c7ec7ce7a205f672b7667f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10e29af134f514c1486167a0bd02d26321c9462b3e68c47f5218742698cd0f46c35fc03b7f8330f1962fc9e245c7acf24a504c39a9af639b1f6dd6fcc07b0480
|
7
|
+
data.tar.gz: 367025be8b69c36daaa8ceccb9f4bed8cc67914d2f95825f33aef1576536db9f78ef0d219ac0a5c3d2f71b88dfd4b789c9bb7b9404a088b22647cb238fe875a3
|
data/.DS_Store
CHANGED
Binary file
|
data/lib/.DS_Store
CHANGED
Binary file
|
@@ -0,0 +1,170 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
3
|
+
|
4
|
+
<svg
|
5
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
6
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
7
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
8
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
10
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
11
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
12
|
+
width="100"
|
13
|
+
height="100"
|
14
|
+
viewBox="0 0 99.999997 99.999997"
|
15
|
+
id="svg4204"
|
16
|
+
version="1.1"
|
17
|
+
inkscape:version="0.91 r13725"
|
18
|
+
sodipodi:docname="bruno_robot.svg"
|
19
|
+
inkscape:export-filename="C:\Users\jkoehler\Dropbox\Inkscape\bruno_robot.png"
|
20
|
+
inkscape:export-xdpi="450"
|
21
|
+
inkscape:export-ydpi="450">
|
22
|
+
<defs
|
23
|
+
id="defs4206" />
|
24
|
+
<sodipodi:namedview
|
25
|
+
id="base"
|
26
|
+
pagecolor="#ffffff"
|
27
|
+
bordercolor="#666666"
|
28
|
+
borderopacity="1.0"
|
29
|
+
inkscape:pageopacity="0.0"
|
30
|
+
inkscape:pageshadow="2"
|
31
|
+
inkscape:zoom="1.5674954"
|
32
|
+
inkscape:cx="28.873239"
|
33
|
+
inkscape:cy="136.23085"
|
34
|
+
inkscape:document-units="px"
|
35
|
+
inkscape:current-layer="svg4204"
|
36
|
+
showgrid="false"
|
37
|
+
units="px"
|
38
|
+
inkscape:window-width="1920"
|
39
|
+
inkscape:window-height="1017"
|
40
|
+
inkscape:window-x="1912"
|
41
|
+
inkscape:window-y="-8"
|
42
|
+
inkscape:window-maximized="1" />
|
43
|
+
<metadata
|
44
|
+
id="metadata4209">
|
45
|
+
<rdf:RDF>
|
46
|
+
<cc:Work
|
47
|
+
rdf:about="">
|
48
|
+
<dc:format>image/svg+xml</dc:format>
|
49
|
+
<dc:type
|
50
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
51
|
+
<dc:title />
|
52
|
+
</cc:Work>
|
53
|
+
</rdf:RDF>
|
54
|
+
</metadata>
|
55
|
+
<g
|
56
|
+
inkscape:label="Ebene 1"
|
57
|
+
inkscape:groupmode="layer"
|
58
|
+
id="layer1">
|
59
|
+
<path
|
60
|
+
style="display:inline;fill:#2a7fff;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none"
|
61
|
+
d="m 53.534888,33.83317 c -2.250486,1.97534 -2.801298,6.26126 1.487997,6.23876 3.167284,2.13094 4.982697,-1.20939 3.222035,-3.53103 -1.256073,-1.9221 -2.455915,-6.91569 -4.710032,-2.70773 z"
|
62
|
+
id="path4620"
|
63
|
+
inkscape:connector-curvature="0" />
|
64
|
+
<path
|
65
|
+
style="display:inline;fill:#2a7fff;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none"
|
66
|
+
d="m 50.741934,47.03468 c 0.169514,4.9045 -1.606266,14.0017 4.27701,6.4786 1.709147,-1.3005 5.167741,0.5999 5.06235,-2.7533 1.083709,-4.33243 -1.161154,-3.9438 -4.505326,-3.93291 -3.328453,-2.16676 -5.744643,-7.71707 -4.834034,0.20761 z"
|
67
|
+
id="path4618"
|
68
|
+
inkscape:connector-curvature="0" />
|
69
|
+
<path
|
70
|
+
style="display:inline;fill:#2a7fff;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none"
|
71
|
+
d="m 56.288473,59.46808 c -1.873711,1.1074 -5.882985,0.7316 -4.465964,4.0124 -0.2201,3.2296 4.09056,6.3835 5.704,2.4389 1.00974,-2.118 3.121602,-7.2302 -1.238036,-6.4513 z"
|
72
|
+
id="path4616"
|
73
|
+
inkscape:connector-curvature="0" />
|
74
|
+
<path
|
75
|
+
style="display:inline;fill:#00ffff;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none"
|
76
|
+
d="m 54.77882,38.99021 c -6.149877,0.74647 -2.077266,11.89177 3.080315,8.02313 2.69963,-2.47779 0.746124,-8.10159 -3.080315,-8.02313 z"
|
77
|
+
id="path4606"
|
78
|
+
inkscape:connector-curvature="0" />
|
79
|
+
<path
|
80
|
+
style="display:inline;fill:#00ffff;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none"
|
81
|
+
d="m 55.890888,52.15318 c -5.442631,-0.2182 -5.796824,10.1184 0.16927,8.644 3.70033,-1.2286 4.455928,-8.2253 -0.16927,-8.644 z"
|
82
|
+
id="path4610"
|
83
|
+
inkscape:connector-curvature="0" />
|
84
|
+
<path
|
85
|
+
style="display:inline;fill:#99ff55;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none"
|
86
|
+
d="m 37.387343,22.41616 c -14.44718,0.63326 -22.771441,16.24125 -21.550394,29.17632 -0.277181,12.7929 9.95217,27.4376 24.138647,25.8816 6.170273,-0.6485 11.351605,-4.6671 14.970529,-9.428 -4.452157,-7.3436 -2.947794,-16.6634 -2.999612,-24.88811 0.276584,-3.93181 0.75605,-7.96443 2.718151,-11.47298 C 50.66731,26.27352 44.394155,22.12346 37.387343,22.41616 Z"
|
87
|
+
id="path4587"
|
88
|
+
inkscape:connector-curvature="0" />
|
89
|
+
<path
|
90
|
+
style="display:inline;fill:#00ff00;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none"
|
91
|
+
d="M 18.784785,16.48976 C 12.57128,15.63677 4.0781114,16.78772 2.279024,23.89781 2.5973705,41.45475 1.5775224,59.14528 2.6864452,76.63328 c 2.373724,7.2892 11.3942248,6.7956 17.5705638,6.4504 16.691087,-0.3113 33.522431,0.7114 50.12946,-0.4606 C 90.086874,79.73758 103.41347,57.42858 96.353624,39.06515 91.421612,23.92934 74.853381,14.35325 59.025721,16.51081 45.612087,16.49651 32.19843,16.46301 18.784785,16.48971 Z m 19.446342,6.68626 c 8.303701,-0.0886 15.238641,6.35901 18.759412,13.2251 2.056718,9.65927 2.656458,20.20546 -1.10222,29.19746 -4.663333,6.0921 -11.451899,12.1085 -19.883292,10.7418 -13.69514,-2.0885 -20.248204,-17.4194 -18.784998,-29.49466 0.532483,-11.14305 8.581939,-23.73137 21.011098,-23.6697 z"
|
92
|
+
id="path4583"
|
93
|
+
inkscape:connector-curvature="0" />
|
94
|
+
<path
|
95
|
+
style="display:inline;fill:#44aa00;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none"
|
96
|
+
d="m 11.691023,96.95448 c -0.691514,-1.9025 -0.650026,-5.6903 0.08072,-7.3686 l 0.141756,-0.3257 26.784684,-0.032 26.784685,-0.032 0.16771,0.2866 c 0.741106,1.2665 0.834332,5.345 0.167074,7.3084 l -0.230149,0.677 -26.854904,0 -26.854903,0 -0.186675,-0.5135 z"
|
97
|
+
id="path4579"
|
98
|
+
inkscape:connector-curvature="0" />
|
99
|
+
<path
|
100
|
+
style="display:inline;fill:#44aa00;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none"
|
101
|
+
d="M 11.640777,10.17889 C 10.949263,8.2763001 10.990751,4.4886701 11.721497,2.8102101 l 0.141759,-0.3255899 26.784683,-0.0321 26.784684,-0.0321 0.16771,0.28659 c 0.741105,1.2664499 0.834332,5.3449499 0.167074,7.3082498 l -0.23015,0.67718 -26.854904,0 -26.854903,0 -0.186674,-0.51359 z"
|
102
|
+
id="path4579-6"
|
103
|
+
inkscape:connector-curvature="0" />
|
104
|
+
<path
|
105
|
+
inkscape:connector-curvature="0"
|
106
|
+
style="fill:none;stroke:#000000;stroke-width:3.82572675;stroke-miterlimit:4;stroke-dasharray:none"
|
107
|
+
d="m 1.9128634,49.18748 0,25.2221 c 0,4.8989 4.637128,8.8426 10.3943236,8.8426 l 52.007241,0 a 33.684581,33.576641 0 0 0 0.08656,0.01 33.684581,33.576641 0 0 0 0.122049,-0.01 l 1.821409,0 c 1.090874,0 2.142617,-0.1419 3.128989,-0.4047 a 33.684581,33.576641 0 0 0 28.613639,-33.169 33.684581,33.576641 0 0 1 -0.004,-0.4919"
|
108
|
+
id="rect3339-2" />
|
109
|
+
<rect
|
110
|
+
rx="1.9857054"
|
111
|
+
ry="5.1384492"
|
112
|
+
y="88.22226"
|
113
|
+
x="10.126063"
|
114
|
+
height="10.276898"
|
115
|
+
width="57.089027"
|
116
|
+
id="rect4154-9"
|
117
|
+
style="fill:none;stroke:#000000;stroke-width:3.00169158;stroke-miterlimit:4;stroke-dasharray:none" />
|
118
|
+
<path
|
119
|
+
inkscape:connector-curvature="0"
|
120
|
+
style="fill:none;stroke:#000000;stroke-width:2.16155505;stroke-miterlimit:4;stroke-dasharray:none"
|
121
|
+
d="m 50.910761,49.45898 a 4.139694,16.706279 0 0 0 -0.0075,1.0351 4.139694,16.706279 0 0 0 0.01068,1.1811 4.139694,16.706279 0 0 0 0.05008,1.6587 4.139694,16.706279 0 0 0 0.09009,1.6276 4.139694,16.706279 0 0 0 0.130312,1.5852 4.139694,16.706279 0 0 0 0.17031,1.5253 4.139694,16.706279 0 0 0 0.205346,1.4479 4.139694,16.706279 0 0 0 0.240439,1.359 4.139694,16.706279 0 0 0 0.273008,1.2544 4.139694,16.706279 0 0 0 0.30303,1.1387 4.139694,16.706279 0 0 0 0.330601,1.0091 4.139694,16.706279 0 0 0 0.353133,0.8737 4.139694,16.706279 0 0 0 0.37068,0.7269 4.139694,16.706279 0 0 0 0.390702,0.5722 4.139694,16.706279 0 0 0 0.4007,0.4137 4.139694,16.706279 0 0 0 0.408239,0.2494 4.139694,16.706279 0 0 0 0.413235,0.083 4.139694,16.706279 0 0 0 0.293032,-0.043 4.139694,16.706279 0 0 0 0.410728,-0.201 4.139694,16.706279 0 0 0 0.162801,-0.1469 29.688722,26.328456 0 0 0 0.608577,-0.7094 4.139694,16.706279 0 0 0 0.025,-0.035 4.139694,16.706279 0 0 0 0.378207,-0.6824 4.139694,16.706279 0 0 0 0.358132,-0.8313 4.139694,16.706279 0 0 0 0.335609,-0.9723 4.139694,16.706279 0 0 0 0.313058,-1.1019 4.139694,16.706279 0 0 0 0.280505,-1.2216 4.139694,16.706279 0 0 0 0.250455,-1.33 4.139694,16.706279 0 0 0 0.217886,-1.4228 4.139694,16.706279 0 0 0 0.177825,-1.504 4.139694,16.706279 0 0 0 0.142688,-1.5678 4.139694,16.706279 0 0 0 0.102658,-1.6179 4.139694,16.706279 0 0 0 0.06248,-1.6529 4.139694,16.706279 0 0 0 0.02005,-1.6663 4.139694,16.706279 0 0 1 -0.0082,-1.034"
|
122
|
+
id="path4190-9" />
|
123
|
+
<path
|
124
|
+
inkscape:connector-curvature="0"
|
125
|
+
style="fill:none;stroke:#000000;stroke-width:2.8934989;stroke-miterlimit:4;stroke-dasharray:none"
|
126
|
+
d="m 16.300782,48.91248 a 21.638489,26.477488 0 0 0 -0.04671,1.7375 21.638489,26.477488 0 0 0 21.638146,26.4781 21.638489,26.477488 0 0 0 16.9761,-10.1033 3.0171969,16.800843 0 0 1 -0.118641,0.1477 3.0171969,16.800843 0 0 1 -0.299361,0.2022 3.0171969,16.800843 0 0 1 -0.213582,0.043 3.0171969,16.800843 0 0 1 -0.301185,-0.084 3.0171969,16.800843 0 0 1 -0.297536,-0.2508 3.0171969,16.800843 0 0 1 -0.292065,-0.4161 3.0171969,16.800843 0 0 1 -0.284759,-0.5754 3.0171969,16.800843 0 0 1 -0.270156,-0.731 3.0171969,16.800843 0 0 1 -0.257378,-0.8787 3.0171969,16.800843 0 0 1 -0.240963,-1.0148 3.0171969,16.800843 0 0 1 -0.220857,-1.145 3.0171969,16.800843 0 0 1 -0.198979,-1.2617 3.0171969,16.800843 0 0 1 -0.175237,-1.3667 3.0171969,16.800843 0 0 1 -0.149681,-1.4561 3.0171969,16.800843 0 0 1 -0.124124,-1.5338 3.0171969,16.800843 0 0 1 -0.09493,-1.5941 3.0171969,16.800843 0 0 1 -0.06571,-1.6369 3.0171969,16.800843 0 0 1 -0.03648,-1.6681 3.0171969,16.800843 0 0 1 -0.0071,-1.1877 3.0171969,16.800843 0 0 1 0.01461,-1.6778 3.0171969,16.800843 0 0 1 4.69e-4,-0.025"
|
127
|
+
id="path4183-4" />
|
128
|
+
<ellipse
|
129
|
+
transform="matrix(-0.84627381,0.5327482,0.18301786,0.98310959,0,0)"
|
130
|
+
ry="3.6780479"
|
131
|
+
rx="3.4933834"
|
132
|
+
cy="83.254036"
|
133
|
+
cx="-47.43858"
|
134
|
+
id="path4194-8"
|
135
|
+
style="fill:none;stroke:#000000;stroke-width:2.79142904;stroke-miterlimit:4;stroke-dasharray:none" />
|
136
|
+
<path
|
137
|
+
inkscape:connector-curvature="0"
|
138
|
+
style="fill:none;stroke:#000000;stroke-width:3.82572675;stroke-miterlimit:4;stroke-dasharray:none"
|
139
|
+
d="m 1.9128634,50.81258 0,-25.22215 c 0,-4.89894 4.637128,-8.8426 10.3943236,-8.8426 l 52.007241,0 a 33.684581,33.576641 0 0 1 0.08656,-0.005 33.684581,33.576641 0 0 1 0.122049,0.005 l 1.821409,0 c 1.090874,0 2.142617,0.14193 3.128989,0.40479 a 33.684581,33.576641 0 0 1 28.613639,33.16886 33.684581,33.576641 0 0 0 -0.004,0.4919"
|
140
|
+
id="rect3339-2-1" />
|
141
|
+
<rect
|
142
|
+
rx="1.9857054"
|
143
|
+
ry="5.1384492"
|
144
|
+
y="-11.777795"
|
145
|
+
x="10.126063"
|
146
|
+
height="10.276898"
|
147
|
+
width="57.089027"
|
148
|
+
id="rect4154-9-4"
|
149
|
+
style="fill:none;stroke:#000000;stroke-width:3.00169158;stroke-miterlimit:4;stroke-dasharray:none"
|
150
|
+
transform="scale(1,-1)" />
|
151
|
+
<path
|
152
|
+
inkscape:connector-curvature="0"
|
153
|
+
style="fill:none;stroke:#000000;stroke-width:2.16155505;stroke-miterlimit:4;stroke-dasharray:none"
|
154
|
+
d="m 50.910761,50.54098 a 4.139694,16.706279 0 0 1 -0.0075,-1.0351 4.139694,16.706279 0 0 1 0.01068,-1.181 4.139694,16.706279 0 0 1 0.05008,-1.65871 4.139694,16.706279 0 0 1 0.09009,-1.62767 4.139694,16.706279 0 0 1 0.130312,-1.58514 4.139694,16.706279 0 0 1 0.17031,-1.52525 4.139694,16.706279 0 0 1 0.205346,-1.44788 4.139694,16.706279 0 0 1 0.240439,-1.35897 4.139694,16.706279 0 0 1 0.273008,-1.2546 4.139694,16.706279 0 0 1 0.30303,-1.13861 4.139694,16.706279 0 0 1 0.330601,-1.00908 4.139694,16.706279 0 0 1 0.353133,-0.87377 4.139694,16.706279 0 0 1 0.37068,-0.72685 4.139694,16.706279 0 0 1 0.390702,-0.57221 4.139694,16.706279 0 0 1 0.4007,-0.41369 4.139694,16.706279 0 0 1 0.408239,-0.24937 4.139694,16.706279 0 0 1 0.413235,-0.0832 4.139694,16.706279 0 0 1 0.293032,0.0425 4.139694,16.706279 0 0 1 0.410728,0.20104 4.139694,16.706279 0 0 1 0.162801,0.14693 29.688722,26.328456 0 0 1 0.608577,0.70945 4.139694,16.706279 0 0 1 0.025,0.0349 4.139694,16.706279 0 0 1 0.378207,0.68237 4.139694,16.706279 0 0 1 0.358132,0.83124 4.139694,16.706279 0 0 1 0.335609,0.97237 4.139694,16.706279 0 0 1 0.313058,1.10187 4.139694,16.706279 0 0 1 0.280505,1.22173 4.139694,16.706279 0 0 1 0.250455,1.32998 4.139694,16.706279 0 0 1 0.217886,1.42279 4.139694,16.706279 0 0 1 0.177825,1.50393 4.139694,16.706279 0 0 1 0.142688,1.56776 4.139694,16.706279 0 0 1 0.102658,1.61802 4.139694,16.706279 0 0 1 0.06248,1.65292 4.139694,16.706279 0 0 1 0.02005,1.6663 4.139694,16.706279 0 0 0 -0.0082,1.0339"
|
155
|
+
id="path4190-9-1" />
|
156
|
+
<path
|
157
|
+
inkscape:connector-curvature="0"
|
158
|
+
style="fill:none;stroke:#000000;stroke-width:2.8934989;stroke-miterlimit:4;stroke-dasharray:none"
|
159
|
+
d="m 16.300782,51.08748 a 21.638489,26.477488 0 0 1 -0.04671,-1.7375 21.638489,26.477488 0 0 1 21.638146,-26.478 21.638489,26.477488 0 0 1 16.9761,10.10326 3.0171969,16.800843 0 0 0 -0.118641,-0.14775 3.0171969,16.800843 0 0 0 -0.299361,-0.20217 3.0171969,16.800843 0 0 0 -0.213582,-0.0427 3.0171969,16.800843 0 0 0 -0.301185,0.0836 3.0171969,16.800843 0 0 0 -0.297536,0.25079 3.0171969,16.800843 0 0 0 -0.292065,0.41604 3.0171969,16.800843 0 0 0 -0.284759,0.57543 3.0171969,16.800843 0 0 0 -0.270156,0.73097 3.0171969,16.800843 0 0 0 -0.257378,0.87871 3.0171969,16.800843 0 0 0 -0.240963,1.01479 3.0171969,16.800843 0 0 0 -0.220857,1.14505 3.0171969,16.800843 0 0 0 -0.198979,1.26171 3.0171969,16.800843 0 0 0 -0.175237,1.36666 3.0171969,16.800843 0 0 0 -0.149681,1.45609 3.0171969,16.800843 0 0 0 -0.124124,1.53387 3.0171969,16.800843 0 0 0 -0.09493,1.59412 3.0171969,16.800843 0 0 0 -0.06571,1.63689 3.0171969,16.800843 0 0 0 -0.03648,1.66804 3.0171969,16.800843 0 0 0 -0.0071,1.1878 3.0171969,16.800843 0 0 0 0.01461,1.6778 3.0171969,16.800843 0 0 0 4.69e-4,0.025"
|
160
|
+
id="path4183-4-3" />
|
161
|
+
<ellipse
|
162
|
+
transform="matrix(-0.84627381,-0.5327482,0.18301786,-0.98310959,0,0)"
|
163
|
+
ry="3.6780479"
|
164
|
+
rx="3.4933834"
|
165
|
+
cy="-7.7939568"
|
166
|
+
cx="-67.128883"
|
167
|
+
id="path4194-8-3"
|
168
|
+
style="fill:none;stroke:#000000;stroke-width:2.79142904;stroke-miterlimit:4;stroke-dasharray:none" />
|
169
|
+
</g>
|
170
|
+
</svg>
|
data/lib/feed_bo/cookie.rb
CHANGED
@@ -3,13 +3,15 @@ module FeedBo
|
|
3
3
|
|
4
4
|
def draw
|
5
5
|
s = Level::FIELD_SIZE
|
6
|
-
|
7
|
-
@svg.image class: "feed_bo_cookie", width: s, height: s, :'xlink:href' => h.image_path("cookie.svg")
|
6
|
+
@svg.image width: s, height: s, :'xlink:href' => h.image_path("cookie.svg")
|
8
7
|
end
|
9
8
|
|
10
9
|
def hit
|
10
|
+
return false if @visible == false
|
11
|
+
|
11
12
|
@level.points += 1
|
12
|
-
|
13
|
+
@visible = false
|
14
|
+
|
13
15
|
@svg.animateTransform attributeName: "transform", type: "scale", from: "1", to: "0",
|
14
16
|
begin: @level.step*Level::STEP_DUR, dur: 0.05, additive: 'sum', fill: 'freeze'
|
15
17
|
@svg.animateMotion by: "#{Level::FIELD_SIZE/2},#{Level::FIELD_SIZE/2}", begin: @level.step*Level::STEP_DUR, dur: 0.05, fill: 'freeze'
|
data/lib/feed_bo/drawable.rb
CHANGED
data/lib/feed_bo/element.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
module FeedBo
|
2
2
|
class Element
|
3
3
|
|
4
|
-
include Draper::ViewHelpers
|
5
4
|
include Drawable
|
6
5
|
|
7
6
|
attr_accessor :level
|
8
|
-
attr_accessor :block_position
|
7
|
+
attr_accessor :block_position, :visible
|
9
8
|
|
10
9
|
def initialize(position=nil)
|
11
10
|
super()
|
12
11
|
@block_position = false
|
12
|
+
@visible = true
|
13
13
|
@position = position if position
|
14
14
|
end
|
15
15
|
|
data/lib/feed_bo/level.rb
CHANGED
@@ -7,7 +7,7 @@ module FeedBo
|
|
7
7
|
STEP_DUR = 0.4
|
8
8
|
TOTAL_STEPS = 100
|
9
9
|
|
10
|
-
attr_accessor :elements, :robot, :step, :points, :target_points, :
|
10
|
+
attr_accessor :elements, :robot, :step, :points, :target_points, :hide_grid
|
11
11
|
|
12
12
|
def initialize
|
13
13
|
@elements = []
|
@@ -15,7 +15,7 @@ module FeedBo
|
|
15
15
|
@frame = 0
|
16
16
|
@points = 0
|
17
17
|
@target_points = 1
|
18
|
-
@
|
18
|
+
@hide_grid = false
|
19
19
|
@svg = ::Builder::XmlMarkup.new
|
20
20
|
end
|
21
21
|
|
@@ -23,12 +23,13 @@ module FeedBo
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def run
|
26
|
+
@robot.setup
|
26
27
|
(@elements + [@robot]).each do |e|
|
27
28
|
e.start_position = e.position.dup
|
28
29
|
e.draw
|
29
30
|
end
|
30
|
-
@robot.run
|
31
|
-
@robot.continue
|
31
|
+
last_activity = @robot.run
|
32
|
+
@robot.continue last_activity
|
32
33
|
return draw
|
33
34
|
end
|
34
35
|
|
@@ -53,7 +54,9 @@ module FeedBo
|
|
53
54
|
|
54
55
|
@svg.svg width: WIDTH*FIELD_SIZE, height: HEIGHT*FIELD_SIZE, version: "1.1", xmlns: "http://www.w3.org/2000/svg",
|
55
56
|
:'xmlns:xlink' => "http://www.w3.org/1999/xlink" do
|
56
|
-
draw_grid
|
57
|
+
draw_grid unless @hide_grid
|
58
|
+
@svg.rect x: 0, y: 0, width: WIDTH*FIELD_SIZE, height: HEIGHT*FIELD_SIZE, style: "stroke: black; fill: none"
|
59
|
+
|
57
60
|
(@elements + [@robot]).each do |e|
|
58
61
|
@svg.g transform: "translate(#{e.start_position[0]*FIELD_SIZE},#{e.start_position[1]*FIELD_SIZE})" do
|
59
62
|
@svg << e.svg.target!
|
@@ -67,10 +70,7 @@ module FeedBo
|
|
67
70
|
end
|
68
71
|
end
|
69
72
|
end
|
70
|
-
|
71
|
-
# File.open("level#{@id}.svg", "w") do |f|
|
72
|
-
# f << @svg.target!
|
73
|
-
# end
|
73
|
+
|
74
74
|
return @svg.target!
|
75
75
|
end
|
76
76
|
|
@@ -108,7 +108,6 @@ module FeedBo
|
|
108
108
|
stroke_width = (i+1) % 5 == 0 ? 0.3 : 0.2
|
109
109
|
@svg.line x1: 0, y1: FIELD_SIZE*(i+1), x2: WIDTH * FIELD_SIZE, y2: FIELD_SIZE*(i+1), style: "stroke: grey; stroke-width: #{stroke_width}"
|
110
110
|
end
|
111
|
-
@svg.rect x: 0, y: 0, width: WIDTH*FIELD_SIZE, height: HEIGHT*FIELD_SIZE, style: "stroke: black; fill: none"
|
112
111
|
end
|
113
112
|
|
114
113
|
end
|
data/lib/feed_bo/robot.rb
CHANGED
@@ -1,105 +1,70 @@
|
|
1
1
|
module FeedBo
|
2
2
|
class Robot
|
3
|
-
|
3
|
+
|
4
4
|
include Drawable
|
5
5
|
include Transformable
|
6
6
|
|
7
7
|
attr_accessor :level
|
8
|
+
attr_reader :tools
|
8
9
|
|
9
10
|
def initialize
|
10
11
|
super
|
11
|
-
@
|
12
|
+
@tools = []
|
12
13
|
end
|
13
14
|
|
14
15
|
def draw
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
@svg.path style: "display:inline;fill:#2a7fff;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none",
|
21
|
-
d: "m 56.288473,59.46808 c -1.873711,1.1074 -5.882985,0.7316 -4.465964,4.0124 -0.2201,3.2296 4.09056,6.3835 5.704,2.4389 1.00974,-2.118 3.121602,-7.2302 -1.238036,-6.4513 z"
|
22
|
-
@svg.path style: "display:inline;fill:#00ffff;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none",
|
23
|
-
d: "m 54.77882,38.99021 c -6.149877,0.74647 -2.077266,11.89177 3.080315,8.02313 2.69963,-2.47779 0.746124,-8.10159 -3.080315,-8.02313 z"
|
24
|
-
@svg.path style: "display:inline;fill:#00ffff;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none",
|
25
|
-
d: "m 55.890888,52.15318 c -5.442631,-0.2182 -5.796824,10.1184 0.16927,8.644 3.70033,-1.2286 4.455928,-8.2253 -0.16927,-8.644 z"
|
26
|
-
@svg.path style: "display:inline;fill:#99ff55;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none",
|
27
|
-
d: "m 37.387343,22.41616 c -14.44718,0.63326 -22.771441,16.24125 -21.550394,29.17632 -0.277181,12.7929 9.95217,27.4376 24.138647,25.8816 6.170273,-0.6485 11.351605,-4.6671 14.970529,-9.428 -4.452157,-7.3436 -2.947794,-16.6634 -2.999612,-24.88811 0.276584,-3.93181 0.75605,-7.96443 2.718151,-11.47298 C 50.66731,26.27352 44.394155,22.12346 37.387343,22.41616 Z"
|
28
|
-
@svg.path style: "display:inline;fill:#00ff00;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none",
|
29
|
-
d: "M 18.784785,16.48976 C 12.57128,15.63677 4.0781114,16.78772 2.279024,23.89781 2.5973705,41.45475 1.5775224,59.14528 2.6864452,76.63328 c 2.373724,7.2892 11.3942248,6.7956 17.5705638,6.4504 16.691087,-0.3113 33.522431,0.7114 50.12946,-0.4606 C 90.086874,79.73758 103.41347,57.42858 96.353624,39.06515 91.421612,23.92934 74.853381,14.35325 59.025721,16.51081 45.612087,16.49651 32.19843,16.46301 18.784785,16.48971 Z m 19.446342,6.68626 c 8.303701,-0.0886 15.238641,6.35901 18.759412,13.2251 2.056718,9.65927 2.656458,20.20546 -1.10222,29.19746 -4.663333,6.0921 -11.451899,12.1085 -19.883292,10.7418 -13.69514,-2.0885 -20.248204,-17.4194 -18.784998,-29.49466 0.532483,-11.14305 8.581939,-23.73137 21.011098,-23.6697 z"
|
30
|
-
@svg.path style: "display:inline;fill:#44aa00;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none",
|
31
|
-
d: "m 11.691023,96.95448 c -0.691514,-1.9025 -0.650026,-5.6903 0.08072,-7.3686 l 0.141756,-0.3257 26.784684,-0.032 26.784685,-0.032 0.16771,0.2866 c 0.741106,1.2665 0.834332,5.345 0.167074,7.3084 l -0.230149,0.677 -26.854904,0 -26.854903,0 -0.186675,-0.5135 z"
|
32
|
-
@svg.path style: "display:inline;fill:#44aa00;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none",
|
33
|
-
d: "M 11.640777,10.17889 C 10.949263,8.2763001 10.990751,4.4886701 11.721497,2.8102101 l 0.141759,-0.3255899 26.784683,-0.0321 26.784684,-0.0321 0.16771,0.28659 c 0.741105,1.2664499 0.834332,5.3449499 0.167074,7.3082498 l -0.23015,0.67718 -26.854904,0 -26.854903,0 -0.186674,-0.51359 z"
|
34
|
-
@svg.path style: "fill:none;stroke:#000000;stroke-width:3.82572675;stroke-miterlimit:4;stroke-dasharray:none",
|
35
|
-
d: "m 1.9128634,49.18748 0,25.2221 c 0,4.8989 4.637128,8.8426 10.3943236,8.8426 l 52.007241,0 a 33.684581,33.576641 0 0 0 0.08656,0.01 33.684581,33.576641 0 0 0 0.122049,-0.01 l 1.821409,0 c 1.090874,0 2.142617,-0.1419 3.128989,-0.4047 a 33.684581,33.576641 0 0 0 28.613639,-33.169 33.684581,33.576641 0 0 1 -0.004,-0.4919"
|
36
|
-
|
37
|
-
@svg.rect rx: "1.9857054", ry: "5.1384492", y: "88.22226", x: "10.126063", height: "10.276898", width: "57.089027",
|
38
|
-
style: "fill:none;stroke:#000000;stroke-width:3.00169158;stroke-miterlimit:4;stroke-dasharray:none"
|
39
|
-
@svg.path style: "fill:none;stroke:#000000;stroke-width:2.16155505;stroke-miterlimit:4;stroke-dasharray:none",
|
40
|
-
d: "m 50.910761,49.45898 a 4.139694,16.706279 0 0 0 -0.0075,1.0351 4.139694,16.706279 0 0 0 0.01068,1.1811 4.139694,16.706279 0 0 0 0.05008,1.6587 4.139694,16.706279 0 0 0 0.09009,1.6276 4.139694,16.706279 0 0 0 0.130312,1.5852 4.139694,16.706279 0 0 0 0.17031,1.5253 4.139694,16.706279 0 0 0 0.205346,1.4479 4.139694,16.706279 0 0 0 0.240439,1.359 4.139694,16.706279 0 0 0 0.273008,1.2544 4.139694,16.706279 0 0 0 0.30303,1.1387 4.139694,16.706279 0 0 0 0.330601,1.0091 4.139694,16.706279 0 0 0 0.353133,0.8737 4.139694,16.706279 0 0 0 0.37068,0.7269 4.139694,16.706279 0 0 0 0.390702,0.5722 4.139694,16.706279 0 0 0 0.4007,0.4137 4.139694,16.706279 0 0 0 0.408239,0.2494 4.139694,16.706279 0 0 0 0.413235,0.083 4.139694,16.706279 0 0 0 0.293032,-0.043 4.139694,16.706279 0 0 0 0.410728,-0.201 4.139694,16.706279 0 0 0 0.162801,-0.1469 29.688722,26.328456 0 0 0 0.608577,-0.7094 4.139694,16.706279 0 0 0 0.025,-0.035 4.139694,16.706279 0 0 0 0.378207,-0.6824 4.139694,16.706279 0 0 0 0.358132,-0.8313 4.139694,16.706279 0 0 0 0.335609,-0.9723 4.139694,16.706279 0 0 0 0.313058,-1.1019 4.139694,16.706279 0 0 0 0.280505,-1.2216 4.139694,16.706279 0 0 0 0.250455,-1.33 4.139694,16.706279 0 0 0 0.217886,-1.4228 4.139694,16.706279 0 0 0 0.177825,-1.504 4.139694,16.706279 0 0 0 0.142688,-1.5678 4.139694,16.706279 0 0 0 0.102658,-1.6179 4.139694,16.706279 0 0 0 0.06248,-1.6529 4.139694,16.706279 0 0 0 0.02005,-1.6663 4.139694,16.706279 0 0 1 -0.0082,-1.034"
|
41
|
-
@svg.path style: "fill:none;stroke:#000000;stroke-width:2.8934989;stroke-miterlimit:4;stroke-dasharray:none",
|
42
|
-
d: "m 16.300782,48.91248 a 21.638489,26.477488 0 0 0 -0.04671,1.7375 21.638489,26.477488 0 0 0 21.638146,26.4781 21.638489,26.477488 0 0 0 16.9761,-10.1033 3.0171969,16.800843 0 0 1 -0.118641,0.1477 3.0171969,16.800843 0 0 1 -0.299361,0.2022 3.0171969,16.800843 0 0 1 -0.213582,0.043 3.0171969,16.800843 0 0 1 -0.301185,-0.084 3.0171969,16.800843 0 0 1 -0.297536,-0.2508 3.0171969,16.800843 0 0 1 -0.292065,-0.4161 3.0171969,16.800843 0 0 1 -0.284759,-0.5754 3.0171969,16.800843 0 0 1 -0.270156,-0.731 3.0171969,16.800843 0 0 1 -0.257378,-0.8787 3.0171969,16.800843 0 0 1 -0.240963,-1.0148 3.0171969,16.800843 0 0 1 -0.220857,-1.145 3.0171969,16.800843 0 0 1 -0.198979,-1.2617 3.0171969,16.800843 0 0 1 -0.175237,-1.3667 3.0171969,16.800843 0 0 1 -0.149681,-1.4561 3.0171969,16.800843 0 0 1 -0.124124,-1.5338 3.0171969,16.800843 0 0 1 -0.09493,-1.5941 3.0171969,16.800843 0 0 1 -0.06571,-1.6369 3.0171969,16.800843 0 0 1 -0.03648,-1.6681 3.0171969,16.800843 0 0 1 -0.0071,-1.1877 3.0171969,16.800843 0 0 1 0.01461,-1.6778 3.0171969,16.800843 0 0 1 4.69e-4,-0.025"
|
43
|
-
@svg.ellipse transform: "matrix(-0.84627381,0.5327482,0.18301786,0.98310959,0,0)",
|
44
|
-
ry: "3.6780479", rx: "3.4933834", cy: "83.254036", cx: "-47.43858", style: "fill:none;stroke:#000000;stroke-width:2.79142904;stroke-miterlimit:4;stroke-dasharray:none"
|
45
|
-
@svg.path style: "fill:none;stroke:#000000;stroke-width:3.82572675;stroke-miterlimit:4;stroke-dasharray:none",
|
46
|
-
d: "m 1.9128634,50.81258 0,-25.22215 c 0,-4.89894 4.637128,-8.8426 10.3943236,-8.8426 l 52.007241,0 a 33.684581,33.576641 0 0 1 0.08656,-0.005 33.684581,33.576641 0 0 1 0.122049,0.005 l 1.821409,0 c 1.090874,0 2.142617,0.14193 3.128989,0.40479 a 33.684581,33.576641 0 0 1 28.613639,33.16886 33.684581,33.576641 0 0 0 -0.004,0.4919"
|
47
|
-
@svg.rect rx: "1.9857054", ry: "5.1384492", y: "-11.777795", x: "10.126063",
|
48
|
-
height: "10.276898", width: "57.089027", transform: "scale(1,-1)",
|
49
|
-
style: "fill:none;stroke:#000000;stroke-width:3.00169158;stroke-miterlimit:4;stroke-dasharray:none"
|
50
|
-
@svg.path style: "fill:none;stroke:#000000;stroke-width:2.16155505;stroke-miterlimit:4;stroke-dasharray:none",
|
51
|
-
d: "m 50.910761,50.54098 a 4.139694,16.706279 0 0 1 -0.0075,-1.0351 4.139694,16.706279 0 0 1 0.01068,-1.181 4.139694,16.706279 0 0 1 0.05008,-1.65871 4.139694,16.706279 0 0 1 0.09009,-1.62767 4.139694,16.706279 0 0 1 0.130312,-1.58514 4.139694,16.706279 0 0 1 0.17031,-1.52525 4.139694,16.706279 0 0 1 0.205346,-1.44788 4.139694,16.706279 0 0 1 0.240439,-1.35897 4.139694,16.706279 0 0 1 0.273008,-1.2546 4.139694,16.706279 0 0 1 0.30303,-1.13861 4.139694,16.706279 0 0 1 0.330601,-1.00908 4.139694,16.706279 0 0 1 0.353133,-0.87377 4.139694,16.706279 0 0 1 0.37068,-0.72685 4.139694,16.706279 0 0 1 0.390702,-0.57221 4.139694,16.706279 0 0 1 0.4007,-0.41369 4.139694,16.706279 0 0 1 0.408239,-0.24937 4.139694,16.706279 0 0 1 0.413235,-0.0832 4.139694,16.706279 0 0 1 0.293032,0.0425 4.139694,16.706279 0 0 1 0.410728,0.20104 4.139694,16.706279 0 0 1 0.162801,0.14693 29.688722,26.328456 0 0 1 0.608577,0.70945 4.139694,16.706279 0 0 1 0.025,0.0349 4.139694,16.706279 0 0 1 0.378207,0.68237 4.139694,16.706279 0 0 1 0.358132,0.83124 4.139694,16.706279 0 0 1 0.335609,0.97237 4.139694,16.706279 0 0 1 0.313058,1.10187 4.139694,16.706279 0 0 1 0.280505,1.22173 4.139694,16.706279 0 0 1 0.250455,1.32998 4.139694,16.706279 0 0 1 0.217886,1.42279 4.139694,16.706279 0 0 1 0.177825,1.50393 4.139694,16.706279 0 0 1 0.142688,1.56776 4.139694,16.706279 0 0 1 0.102658,1.61802 4.139694,16.706279 0 0 1 0.06248,1.65292 4.139694,16.706279 0 0 1 0.02005,1.6663 4.139694,16.706279 0 0 0 -0.0082,1.0339"
|
52
|
-
@svg.path style: "fill:none;stroke:#000000;stroke-width:2.8934989;stroke-miterlimit:4;stroke-dasharray:none",
|
53
|
-
d: "m 16.300782,51.08748 a 21.638489,26.477488 0 0 1 -0.04671,-1.7375 21.638489,26.477488 0 0 1 21.638146,-26.478 21.638489,26.477488 0 0 1 16.9761,10.10326 3.0171969,16.800843 0 0 0 -0.118641,-0.14775 3.0171969,16.800843 0 0 0 -0.299361,-0.20217 3.0171969,16.800843 0 0 0 -0.213582,-0.0427 3.0171969,16.800843 0 0 0 -0.301185,0.0836 3.0171969,16.800843 0 0 0 -0.297536,0.25079 3.0171969,16.800843 0 0 0 -0.292065,0.41604 3.0171969,16.800843 0 0 0 -0.284759,0.57543 3.0171969,16.800843 0 0 0 -0.270156,0.73097 3.0171969,16.800843 0 0 0 -0.257378,0.87871 3.0171969,16.800843 0 0 0 -0.240963,1.01479 3.0171969,16.800843 0 0 0 -0.220857,1.14505 3.0171969,16.800843 0 0 0 -0.198979,1.26171 3.0171969,16.800843 0 0 0 -0.175237,1.36666 3.0171969,16.800843 0 0 0 -0.149681,1.45609 3.0171969,16.800843 0 0 0 -0.124124,1.53387 3.0171969,16.800843 0 0 0 -0.09493,1.59412 3.0171969,16.800843 0 0 0 -0.06571,1.63689 3.0171969,16.800843 0 0 0 -0.03648,1.66804 3.0171969,16.800843 0 0 0 -0.0071,1.1878 3.0171969,16.800843 0 0 0 0.01461,1.6778 3.0171969,16.800843 0 0 0 4.69e-4,0.025"
|
54
|
-
@svg.ellipse transform: "matrix(-0.84627381,-0.5327482,0.18301786,-0.98310959,0,0)",
|
55
|
-
ry: "3.6780479", rx: "3.4933834", cy: "-7.7939568", cx: "-67.128883",
|
56
|
-
style: "fill:none;stroke:#000000;stroke-width:2.79142904;stroke-miterlimit:4;stroke-dasharray:none"
|
16
|
+
s = Level::FIELD_SIZE
|
17
|
+
@svg.image width: s, height: s, :'xlink:href' => h.image_path("robot.svg")
|
18
|
+
|
19
|
+
@tools.each do |tool|
|
20
|
+
tool.draw(@svg)
|
57
21
|
end
|
58
22
|
end
|
59
|
-
|
60
|
-
def
|
61
|
-
s = Level::FIELD_SIZE
|
62
|
-
@svg.polygon points: "0,0 #{s},#{s/2} 0,#{s}", style: "stroke: black; fill: red"
|
23
|
+
|
24
|
+
def setup
|
63
25
|
end
|
64
26
|
|
65
27
|
def run
|
66
28
|
end
|
67
29
|
|
68
|
-
def continue
|
69
|
-
until @level.finish?
|
70
|
-
|
71
|
-
@level.perform_step
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
protected
|
76
|
-
|
77
|
-
def move(steps=nil)
|
78
|
-
return false if @level.finish?
|
79
|
-
@moving = true
|
80
|
-
if steps
|
81
|
-
steps.times do
|
30
|
+
def continue(last_activity)
|
31
|
+
until @level.finish?
|
32
|
+
if last_activity == :move
|
82
33
|
move
|
34
|
+
else
|
35
|
+
@level.perform_step
|
83
36
|
end
|
84
|
-
@moving = false
|
85
|
-
else
|
86
|
-
perform_move
|
87
|
-
@level.perform_step
|
88
37
|
end
|
89
38
|
end
|
90
|
-
|
91
|
-
def
|
92
|
-
|
39
|
+
|
40
|
+
def add_tool(tool)
|
41
|
+
tool.robot = self
|
42
|
+
@tools << tool
|
43
|
+
end
|
44
|
+
|
45
|
+
def hit_positions
|
46
|
+
positions = [Level.vector_sum(@position, movement)]
|
47
|
+
if @direction.odd?
|
48
|
+
positions << Level.vector_sum(@position, [movement[0],0])
|
49
|
+
positions << Level.vector_sum(@position, [0,movement[1]])
|
50
|
+
end
|
51
|
+
return positions
|
93
52
|
end
|
94
53
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
54
|
+
protected
|
55
|
+
|
56
|
+
def move(steps=1)
|
57
|
+
steps.times do
|
58
|
+
if hit_positions.none? { |p| @level.position_blocked? p }
|
59
|
+
@level.elements.select { |e| hit_positions.include? e.position }.each do |e|
|
60
|
+
e.hit if e.respond_to? :hit
|
61
|
+
end
|
62
|
+
@position = Level.vector_sum(@position, movement)
|
63
|
+
animate_move
|
99
64
|
end
|
100
|
-
@
|
101
|
-
animate_move
|
65
|
+
@level.perform_step
|
102
66
|
end
|
67
|
+
return :move
|
103
68
|
end
|
104
69
|
|
105
70
|
def movement
|
@@ -116,15 +81,6 @@ module FeedBo
|
|
116
81
|
return [x, y]
|
117
82
|
end
|
118
83
|
|
119
|
-
def hit_positions
|
120
|
-
positions = [Level.vector_sum(@position, movement)]
|
121
|
-
if @direction.odd?
|
122
|
-
positions << Level.vector_sum(@position, [movement[0],0])
|
123
|
-
positions << Level.vector_sum(@position, [0,movement[1]])
|
124
|
-
end
|
125
|
-
return positions
|
126
|
-
end
|
127
|
-
|
128
84
|
def animate_move
|
129
85
|
@svg.animateMotion values: "0,0; #{movement[0]*Level::FIELD_SIZE},#{movement[1]*Level::FIELD_SIZE}",
|
130
86
|
begin: "#{@level.step*Level::STEP_DUR}s", dur: "#{Level::STEP_DUR}s", additive: 'sum', fill: 'freeze'
|
@@ -154,6 +110,12 @@ module FeedBo
|
|
154
110
|
@svg.animateTransform attributeName: 'transform', type: 'rotate', values: "0,#{s/2},#{s/2}; #{step*45},#{s/2},#{s/2}",
|
155
111
|
begin: "#{@level.step*Level::STEP_DUR}s", dur: "#{Level::STEP_DUR}s", additive: 'sum', fill: 'freeze'
|
156
112
|
end
|
113
|
+
|
114
|
+
def wait(steps=1)
|
115
|
+
steps.times do
|
116
|
+
@level.perform_step
|
117
|
+
end
|
118
|
+
end
|
157
119
|
|
158
120
|
end
|
159
121
|
end
|
data/lib/feed_bo/tool.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
module FeedBo
|
2
|
+
class TouchSensor < Tool
|
3
|
+
|
4
|
+
def draw(svg)
|
5
|
+
fs = Level::FIELD_SIZE.to_f
|
6
|
+
svg.g transform: "scale(#{fs/100})" do
|
7
|
+
svg.rect width: 10, height: 12, x: 92, y: 44, fill: 'red'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def touched?
|
12
|
+
@robot.hit_positions.any? { |p| @robot.level.position_blocked? p }
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
data/lib/feed_bo/version.rb
CHANGED
data/lib/feed_bo/wall.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
module FeedBo
|
2
2
|
class Wall < Element
|
3
3
|
|
4
|
-
def initialize
|
4
|
+
def initialize(position=nil)
|
5
5
|
super
|
6
6
|
@block_position = true
|
7
7
|
end
|
8
8
|
|
9
9
|
def draw
|
10
|
-
|
10
|
+
fs = Level::FIELD_SIZE
|
11
|
+
@svg.rect width: fs, height: fs, fill: '#37c8ab', stroke: '#0b2822'
|
11
12
|
end
|
12
13
|
|
13
14
|
end
|
data/lib/feed_bo.rb
CHANGED
@@ -9,9 +9,11 @@ require "feed_bo/element"
|
|
9
9
|
require "feed_bo/level"
|
10
10
|
require "feed_bo/robot"
|
11
11
|
require "feed_bo/wall"
|
12
|
-
require "feed_bo/balloon"
|
13
12
|
require "feed_bo/cookie"
|
14
13
|
|
14
|
+
require "feed_bo/tool"
|
15
|
+
require "feed_bo/touch_sensor"
|
16
|
+
|
15
17
|
module FeedBo
|
16
18
|
|
17
19
|
def self.evaluate(code)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feed_bo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jannes Köhler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -82,14 +82,16 @@ files:
|
|
82
82
|
- feed_bo.gemspec
|
83
83
|
- lib/.DS_Store
|
84
84
|
- lib/assets/images/cookie.svg
|
85
|
+
- lib/assets/images/robot.svg
|
85
86
|
- lib/feed_bo.rb
|
86
|
-
- lib/feed_bo/balloon.rb
|
87
87
|
- lib/feed_bo/cookie.rb
|
88
88
|
- lib/feed_bo/drawable.rb
|
89
89
|
- lib/feed_bo/element.rb
|
90
90
|
- lib/feed_bo/engine.rb
|
91
91
|
- lib/feed_bo/level.rb
|
92
92
|
- lib/feed_bo/robot.rb
|
93
|
+
- lib/feed_bo/tool.rb
|
94
|
+
- lib/feed_bo/touch_sensor.rb
|
93
95
|
- lib/feed_bo/transformable.rb
|
94
96
|
- lib/feed_bo/version.rb
|
95
97
|
- lib/feed_bo/wall.rb
|
data/lib/feed_bo/balloon.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module FeedBo
|
2
|
-
class Balloon < Element
|
3
|
-
|
4
|
-
def draw
|
5
|
-
s = Level::FIELD_SIZE
|
6
|
-
@svg.circle id: 'balloon', cx: s/2, cy: s/2, r: s/2, stroke: 'black', fill: 'blue'
|
7
|
-
end
|
8
|
-
|
9
|
-
def hit
|
10
|
-
@level.points += 1
|
11
|
-
|
12
|
-
@svg.animateTransform attributeName: "transform", type: "scale", from: "1", to: "0",
|
13
|
-
begin: @level.step*Level::STEP_DUR, dur: 0.05, additive: 'sum', fill: 'freeze'
|
14
|
-
@svg.animateMotion by: "#{Level::FIELD_SIZE/2},#{Level::FIELD_SIZE/2}", begin: @level.step*Level::STEP_DUR, dur: 0.05, fill: 'freeze'
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|