This repository has been archived by the owner on Jul 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcamera blocks 2.xml
19 lines (19 loc) · 14.4 KB
/
camera blocks 2.xml
1
<blocks app="Snap! 4.0, http://snap.berkeley.edu" version="1"><block-definition s="Do %'handle response' with what Google sees and show the photo %'show'" type="command" category="sensing"><header></header><code></code><inputs><input type="%cmdRing"></input><input type="%b"></input></inputs><script><custom-block s="Ask %txt to say what it sees then %cmdRing and show the picture %s"><l>Google</l><block s="reifyScript"><script><block s="doRun"><block var="handle response"/><list><custom-block s="map %repRing over %mult%l"><block s="reifyReporter"><autolambda><block s="reportListItem"><l>2</l><block s="reportListItem"><l>2</l><l/></block></block></autolambda><list></list></block><list><block s="reportListItem"><l>2</l><block s="reportListItem"><l>1</l><block s="reportListItem"><l>1</l><block var="response"/></block></block></block></list></custom-block></list></block></script><list><l>response</l></list></block><block var="show"/></custom-block></script></block-definition><block-definition s="Do %'handle response' with what IBM Watson sees and show the photo %'show'" type="command" category="sensing"><header></header><code></code><inputs><input type="%cmdRing"></input><input type="%b"></input></inputs><script><custom-block s="Ask %txt to say what it sees then %cmdRing and show the picture %s"><l>Watson</l><block s="reifyScript"><script><block s="doRun"><block var="handle response"/><list><custom-block s="map %repRing over %mult%l"><block s="reifyReporter"><autolambda><block s="reportListItem"><l>2</l><block s="reportListItem"><l>1</l><l/></block></block></autolambda><list></list></block><list><block var="response"/></list></custom-block></list></block></script><list><l>response</l></list></block><block var="show"/></custom-block></script></block-definition><block-definition s="Do %'handle response' with what Microsoft sees and show the photo %'show'" type="command" category="sensing"><header></header><code></code><inputs><input type="%cmdRing"></input><input type="%b"></input></inputs><script><custom-block s="Ask %txt to say what it sees then %cmdRing and show the picture %s"><l>Microsoft</l><block s="reifyScript"><script><block s="doRun"><block var="handle response"/><list><block s="reportListItem"><l>2</l><block s="reportListItem"><l>1</l><block s="reportListItem"><l>2</l><block s="reportListItem"><l>3</l><block var="responses"/></block></block></block></block></list></block></script><list><l>responses</l></list></block><block var="show"/></custom-block></script></block-definition><block-definition s="list $arrowRight word %'list'" type="reporter" category="operators"><header></header><code></code><inputs><input type="%l"></input></inputs><script><block s="doWarp"><script><block s="doReport"><block s="reportJoinWords"><block var="list"/></block></block></script></block></script></block-definition><block-definition s="word $arrowRight list %'word'" type="reporter" category="operators"><header></header><code></code><inputs><input type="%txt"></input></inputs><script><block s="doWarp"><script><block s="doReport"><block s="reportTextSplit"><block var="word"/><l><option>letter</option></l></block></block></script></block></script></block-definition><block-definition s="sentence $arrowRight list %'text'" type="reporter" category="operators"><header></header><code></code><inputs><input type="%txt"></input></inputs><script><block s="doWarp"><script><block s="doReport"><block s="reportTextSplit"><block var="text"/><l><option>whitespace</option></l></block></block></script></block></script></block-definition><block-definition s="list $arrowRight sentence %'data'" type="reporter" category="operators"><header></header><code></code><inputs><input type="%l"></input></inputs><script><block s="doWarp"><script><block s="doReport"><custom-block s="join words %mult%txt"><block var="data"/></custom-block></block></script></block></script></block-definition><block-definition s="join words %'words'" type="reporter" category="operators"><header></header><code></code><inputs><input type="%mult%txt"></input></inputs><script><block s="doWarp"><script><block s="doIf"><custom-block s="empty? %l"><block s="reportCDR"><block var="words"/></block></custom-block><script><block s="doReport"><block s="reportListItem"><l>1</l><block var="words"/></block></block></script></block><block s="doIf"><block s="reportEquals"><l></l><block s="reportListItem"><l>1</l><block var="words"/></block></block><script><block s="doReport"><custom-block s="join words %mult%txt"><block s="reportCDR"><block var="words"/></block></custom-block></block></script></block><block s="doIf"><block s="reportEquals"><l></l><block s="reportListItem"><l>2</l><block var="words"/></block></block><script><block s="doReport"><custom-block s="join words %mult%txt"><block s="reportCONS"><block s="reportListItem"><l>1</l><block var="words"/></block><block s="reportCDR"><block s="reportCDR"><block var="words"/></block></block></block></custom-block></block></script></block><block s="doReport"><block s="reportJoinWords"><list><block s="reportListItem"><l>1</l><block var="words"/></block><l> </l><custom-block s="join words %mult%txt"><block s="reportCDR"><block var="words"/></block></custom-block></list></block></block></script></block></script><scripts><script x="229.000003" y="196.77778077777774"><block s="reportJoinWords"><list><l></l><l></l></list></block></script></scripts></block-definition><block-definition s="map %'function' over %'lists'" type="reporter" category="lists"><header></header><code></code><inputs><input type="%repRing"></input><input type="%mult%l"></input></inputs><script><block s="doWarp"><script><block s="doDeclareVariables"><list><l>mapone</l><l>mapmany</l></list></block><block s="doSetVar"><l>mapone</l><block s="reifyScript"><script><block s="doIf"><custom-block s="empty? %l"><block var="data"/></custom-block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block><block s="doReport"><block s="reportCONS"><block s="evaluate"><block var="function"/><list><block s="reportListItem"><l>1</l><block var="data"/></block></list></block><block s="evaluate"><block var="mapone"/><list><block s="reportCDR"><block var="data"/></block></list></block></block></block></script><list><l>data</l></list></block></block><block s="doSetVar"><l>mapmany</l><block s="reifyScript"><script><block s="doIf"><custom-block s="empty? %l"><block s="reportListItem"><l>1</l><block var="data lists"/></block></custom-block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block><block s="doReport"><block s="reportCONS"><block s="evaluate"><block var="function"/><custom-block s="map %repRing over %mult%l"><block s="reifyReporter"><autolambda><block s="reportListItem"><l>1</l><l/></block></autolambda><list></list></block><list><block var="data lists"/></list></custom-block></block><block s="evaluate"><block var="mapmany"/><list><custom-block s="map %repRing over %mult%l"><block s="reifyReporter"><autolambda><block s="reportCDR"><l/></block></autolambda><list></list></block><list><block var="data lists"/></list></custom-block></list></block></block></block></script><list><l>data lists</l></list></block></block><block s="doIfElse"><custom-block s="empty? %l"><block s="reportCDR"><block var="lists"/></block></custom-block><script><block s="doReport"><block s="evaluate"><block var="mapone"/><list><block s="reportListItem"><l>1</l><block var="lists"/></block></list></block></block></script><script><block s="doReport"><block s="evaluate"><block var="mapmany"/><list><block var="lists"/></list></block></block></script></block></script></block></script></block-definition><block-definition s="empty? %'data'" type="predicate" category="lists"><header></header><code></code><inputs><input type="%l"></input></inputs><script><block s="doReport"><block s="reportEquals"><block var="data"/><block s="reportNewList"><list></list></block></block></block></script></block-definition><block-definition s="keep items such that %'pred' from %'data'" type="reporter" category="lists"><header></header><code></code><inputs><input type="%predRing"></input><input type="%l"></input></inputs><script><block s="doWarp"><script><block s="doIf"><custom-block s="empty? %l"><block var="data"/></custom-block><script><block s="doReport"><block s="reportNewList"><list></list></block></block></script></block><block s="doIfElse"><block s="evaluate"><block var="pred"/><list><block s="reportListItem"><l>1</l><block var="data"/></block></list></block><script><block s="doReport"><block s="reportCONS"><block s="reportListItem"><l>1</l><block var="data"/></block><custom-block s="keep items such that %predRing from %l"><block var="pred"/><block s="reportCDR"><block var="data"/></block></custom-block></block></block></script><script><block s="doReport"><custom-block s="keep items such that %predRing from %l"><block var="pred"/><block s="reportCDR"><block var="data"/></block></custom-block></block></script></block></script></block></script></block-definition><block-definition s="combine with %'function' items of %'data'" type="reporter" category="lists"><header></header><code></code><inputs><input type="%repRing"></input><input type="%l"></input></inputs><script><block s="doWarp"><script><block s="doIf"><custom-block s="empty? %l"><block s="reportCDR"><block var="data"/></block></custom-block><script><block s="doReport"><block s="reportListItem"><l>1</l><block var="data"/></block></block></script></block><block s="doReport"><block s="evaluate"><block var="function"/><list><block s="reportListItem"><l>1</l><block var="data"/></block><custom-block s="combine with %repRing items of %l"><block var="function"/><block s="reportCDR"><block var="data"/></block></custom-block></list></block></block></script></block></script></block-definition><block-definition s="for each %'item' of %'data' %'action'" type="command" category="lists"><header></header><code></code><inputs><input type="%upvar"></input><input type="%l"></input><input type="%cs"></input></inputs><script><block s="doUntil"><custom-block s="empty? %l"><block var="data"/></custom-block><script><block s="doSetVar"><l>item</l><block s="reportListItem"><l>1</l><block var="data"/></block></block><block s="doRun"><block var="action"/><list><block s="reportListItem"><l>1</l><block var="data"/></block></list></block><block s="doSetVar"><l>data</l><block s="reportCDR"><block var="data"/></block></block></script></block></script></block-definition><block-definition s="Setup camera %'width' %'height'" type="command" category="other"><header></header><code></code><inputs><input type="%n"></input><input type="%n"></input></inputs><script><custom-block s="run eCraft2Learn command %txt with %mult%s"><l>setup_camera</l><list><block var="width"/><block var="height"/></list></custom-block></script></block-definition><block-definition s="run eCraft2Learn command %'command name' with %'inputs'" type="command" category="other"><header></header><code></code><inputs><input type="%txt"></input><input type="%mult%s"></input></inputs><script><block s="doRun"><block s="reportJSFunction"><list><l>function_name</l><l>parameters</l></list><l>"use strict";






if (typeof ecraft2learn === 'object') {






 ecraft2learn.snap_context = this;






 ecraft2learn.run(function_name, parameters);






} else {






 var script = document.createElement("script");






 script.type = "text/javascript";






 script.src = "https://toontalk.github.io/ai-cloud/ecraft2learn.js";






 script.addEventListener('load', function () {






 ecraft2learn.snap_context = this;






 ecraft2learn.run(function_name, parameters);






 }.bind(this));






 document.head.appendChild(script);






}</l></block><list><block var="command name"/><block var="inputs"/></list></block></script></block-definition><block-definition s="call eCraft2Learn reporter %'reporter name' with %'inputs'" type="reporter" category="other"><header></header><code></code><inputs><input type="%txt"></input><input type="%mult%s"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>function_name</l><l>parameters</l></list><l>if (typeof ecraft2learn === 'object') {











 return ecraft2learn.run(function_name, parameters);











} else {











 alert("Any eCraft2Learn command must be run before the " + function_name + " reporter.");











 return 0;











}</l></block><list><block var="reporter name"/><block var="inputs"/></list></block></block></script></block-definition><block-definition s="Watson image key" type="reporter" category="other"><header></header><code></code><inputs></inputs><script><block s="doReport"><l>Enter your key here</l></block></script></block-definition><block-definition s="Microsoft image key" type="reporter" category="other"><header></header><code></code><inputs></inputs><script><block s="doReport"><l>Enter your key here</l></block></script></block-definition><block-definition s="Google image key" type="reporter" category="other"><header></header><code></code><inputs></inputs><script><block s="doReport"><l>Enter your key here</l></block></script></block-definition><block-definition s="Ask %'cloud provider' to say what it sees then %'then receive response' and show the picture %'show photo?'" type="command" category="other"><header></header><code></code><inputs><input type="%txt"></input><input type="%cmdRing"></input><input type="%s"></input></inputs><script><custom-block s="run eCraft2Learn command %txt with %mult%s"><l>take_picture_and_analyse</l><list><block var="cloud provider"/><block var="show photo?"/><block var="then receive response"/></list></custom-block></script></block-definition></blocks>