Last active
July 2, 2018 14:57
-
-
Save kenwebb/34fee44ded8f71b523ed3d57e3f26859 to your computer and use it in GitHub Desktop.
Fishing Rod
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Mon Jul 02 2018 10:57:22 GMT-0400 (Eastern Daylight Time)--> | |
<XholonWorkbook> | |
<Notes><![CDATA[ | |
Xholon | |
------ | |
Title: Fishing Rod | |
Description: | |
Url: http://www.primordion.com/Xholon/gwt/ | |
InternalName: 34fee44ded8f71b523ed3d57e3f26859 | |
Keywords: | |
My Notes | |
-------- | |
July 2, 2018 | |
This workbook is about a general concept, and a specific case that's come up while doing the Island simulation. | |
bplex = binding/bind/bound + complex | |
- an emergent/virtual node/complex created through port bindings between other nodes | |
see my notebook for July 1, 2018 | |
Avatar actions, setting up a bplex (in Dev Tools): | |
-------------- | |
var ava = temp1; | |
ava.action("param debug true"); | |
ava.action("where"); | |
ava.action("look"); | |
ava.action("i"); | |
ava.action("smash xpath(Avatar/FishingRod)"); | |
ava.action("i"); | |
ava.action("drop bait"); | |
ava.action("i"); | |
ava.action("look"); | |
Graphviz | |
-------- | |
Graphviz | |
gridCell_46 | |
{"gvFileExt":".gv","gvGraph":"digraph","layout":"dot","edgeOp":"->","gvCluster":"cluster","shouldShowStateMachineEntities":false,"filter":"--Script","nameTemplateNodeId":"R^^^^^","nameTemplateNodeLabel":"R^^^^^","shouldQuoteLabels":true,"shouldShowLinks":true,"shouldShowLinkLabels":false,"shouldSpecifyLayout":false,"maxLabelLen":-1,"shouldColor":true,"defaultNodeColor":"#f0f8ff","bgGraphColor":"white","shouldSpecifyShape":true,"shape":"rect","shouldSpecifySize":true,"size":"20","shouldSpecifyFontname":false,"fontname":"Courier","shouldSpecifyArrowhead":true,"arrowhead":"vee","shouldSpecifyStylesheet":true,"stylesheet":"Xholon.css","shouldSpecifyRankdir":true,"rankdir":"LR","shouldDisplayGraph":true,"outputFormat":"svg"} | |
]]></Notes> | |
<_-.XholonClass> | |
<PhysicalSystem/> | |
<GridCell/> | |
<!-- | |
FishingRod is an emergent object that is more than the sum of it's parts. | |
It provides various services at the start of running the app. | |
Perhaps it should be a forest? NO | |
Or it may be smashed once the bplex is set up. | |
--> | |
<FishingRod/> | |
<Stick/> | |
<String/> | |
<Hook/> | |
<Bait/> | |
<Fish/> | |
</_-.XholonClass> | |
<xholonClassDetails> | |
<Stick> | |
<port name="FishingRodbplex" connector="../String"/> | |
<Color>orange</Color> | |
</Stick> | |
<String> | |
<port name="FishingRodbplex" connector="../Hook"/> | |
<Color>yellow</Color> | |
</String> | |
<Hook> | |
<port name="FishingRodbplex" connector="../Bait"/> | |
<Color>green</Color> | |
</Hook> | |
<Bait> | |
<port name="FishingRodbplex" connector="../Stick"/> <!-- during postConfigure(), this will be changed to point to FishingRodbehavior, which in turn will point to Stick --> | |
<Color>blue</Color> | |
</Bait> | |
</xholonClassDetails> | |
<PhysicalSystem> | |
<GridCell> | |
<Avatar roleName="Fisherman"> | |
<Attribute_String><![CDATA[ | |
wait 1; | |
smash xpath(Avatar/FishingRod); | |
drop bait; | |
]]></Attribute_String> | |
<FishingRod> | |
<Stick/> | |
<String/> | |
<Hook/> | |
<Bait/> | |
</FishingRod> | |
</Avatar> | |
<Fish/> | |
</GridCell> | |
<Animate duration="2" selection="#xhanim" xpath="./PhysicalSystem/GridCell" cssStyle=".d3cpnode circle {stroke-width: 0px;}" efParams="{"selection":"#xhanim","sort":"disable","width":400,"height":400,"mode":"tween","labelContainers":true,"includeId":true,"shape":"circle","useIcons":false}"/> | |
</PhysicalSystem> | |
<FishingRodbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
const BPLEX = "FishingRodbplex"; | |
var me, bait, baitSwallowed, beh = { | |
postConfigure: function() { | |
me = this.cnode.parent(); | |
this.cnode.color("red"); | |
// insert itself into the bplex | |
this.cnode[BPLEX] = this.cnode.prev()[BPLEX]; | |
this.cnode.prev()[BPLEX] = this.cnode; | |
// traverse the bplex looking for Bait | |
node = this.cnode[BPLEX]; | |
while (node != this.cnode) { | |
if (node.xhc().name() == "Bait") { | |
bait = node; | |
break; | |
} | |
node = node[BPLEX]; | |
} | |
this.cnode.println("looked for Bait " + bait); | |
baitSwallowed = false; | |
}, | |
act: function() { | |
//me.println(this.toString()); | |
if (!baitSwallowed && bait && (bait.parent().xhc().name() == "Fish")) { | |
baitSwallowed = true; | |
this.cnode.println("The fish has swallowed the bait."); | |
} | |
} | |
} | |
//# sourceURL=FishingRodbehavior.js | |
]]></FishingRodbehavior> | |
<Fishbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[ | |
var fish, beh = { | |
postConfigure: function() { | |
fish = this.cnode.parent(); | |
}, | |
act: function() { | |
var food = fish.next(); | |
if (!food) {return;} | |
var rnum = $wnd.Math.random(); | |
if (rnum > 0.75) { | |
// take the food, and start to eat it | |
fish.append(food.remove()); | |
} | |
} | |
} | |
//# sourceURL=Fishbehavior.js | |
]]></Fishbehavior> | |
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml, | |
<svg width="526pt" height="223pt" | |
viewBox="0.00 0.00 526.00 222.80" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
<g id="GridCell" class="graph" transform="scale(1 1) rotate(0) translate(4 218.8)"> | |
<title>GridCell</title> | |
<polygon fill="white" stroke="none" points="-4,4 -4,-218.8 522,-218.8 522,4 -4,4"/> | |
<text text-anchor="middle" x="259" y="-8.2" font-family="Times,serif" font-size="14.00">GridCell</text> | |
<g id="GridCell/Avatar" class="cluster"><title>clusterFisherman</title> | |
<polygon fill="white" stroke="black" points="8,-39.8 8,-116.8 436,-116.8 436,-39.8 8,-39.8"/> | |
<text text-anchor="middle" x="222" y="-100.2" font-family="Times,serif" font-size="14.00">Fisherman</text> | |
</g> | |
<!-- Stick --> | |
<g id="GridCell/Avatar/Stick" class="node"><title>Stick</title> | |
<polygon fill="orange" stroke="black" points="242,-83.8 188,-83.8 188,-47.8 242,-47.8 242,-83.8"/> | |
<text text-anchor="middle" x="215" y="-61.6" font-family="Times,serif" font-size="14.00">Stick</text> | |
</g> | |
<!-- String --> | |
<g id="GridCell/Avatar/String" class="node"><title>String</title> | |
<polygon fill="yellow" stroke="black" points="338,-83.8 284,-83.8 284,-47.8 338,-47.8 338,-83.8"/> | |
<text text-anchor="middle" x="311" y="-61.6" font-family="Times,serif" font-size="14.00">String</text> | |
</g> | |
<!-- Stick->String --> | |
<g id="GridCell_edge1" class="edge"><title>Stick->String</title> | |
<path fill="none" stroke="black" d="M242.184,-65.8C251.963,-65.8 263.247,-65.8 273.771,-65.8"/> | |
<polygon fill="black" stroke="black" points="283.956,-65.8 273.956,-70.3001 278.956,-65.8 273.956,-65.8001 273.956,-65.8001 273.956,-65.8001 278.956,-65.8 273.956,-61.3001 283.956,-65.8 283.956,-65.8"/> | |
</g> | |
<!-- Hook --> | |
<g id="GridCell/Avatar/Hook" class="node"><title>Hook</title> | |
<polygon fill="green" stroke="black" points="428,-83.8 374,-83.8 374,-47.8 428,-47.8 428,-83.8"/> | |
<text text-anchor="middle" x="401" y="-61.6" font-family="Times,serif" font-size="14.00">Hook</text> | |
</g> | |
<!-- String->Hook --> | |
<g id="GridCell_edge2" class="edge"><title>String->Hook</title> | |
<path fill="none" stroke="black" d="M338.403,-65.8C346.393,-65.8 355.311,-65.8 363.824,-65.8"/> | |
<polygon fill="black" stroke="black" points="373.919,-65.8 363.919,-70.3001 368.919,-65.8 363.919,-65.8001 363.919,-65.8001 363.919,-65.8001 368.919,-65.8 363.919,-61.3001 373.919,-65.8 373.919,-65.8"/> | |
</g> | |
<!-- Bait --> | |
<g id="GridCell/descendant::Bait" class="node"><title>Bait</title> | |
<polygon fill="blue" stroke="black" points="518,-60.8 464,-60.8 464,-24.8 518,-24.8 518,-60.8"/> | |
<text text-anchor="middle" x="491" y="-38.6" font-family="Times,serif" font-size="14.00">Bait</text> | |
</g> | |
<!-- Hook->Bait --> | |
<g id="GridCell_edge4" class="edge"><title>Hook->Bait</title> | |
<path fill="none" stroke="black" d="M428.403,-58.8992C436.481,-56.7879 445.507,-54.4289 454.105,-52.1818"/> | |
<polygon fill="black" stroke="black" points="463.919,-49.6166 455.382,-56.4991 459.081,-50.881 454.244,-52.1454 454.244,-52.1454 454.244,-52.1454 459.081,-50.881 453.106,-47.7916 463.919,-49.6166 463.919,-49.6166"/> | |
</g> | |
<!-- FishingRodbehavior --> | |
<g id="GridCell/Avatar/FishingRodbehavior" class="node"><title>FishingRodbehavior</title> | |
<polygon fill="red" stroke="black" points="146.326,-83.8 15.6742,-83.8 15.6742,-47.8 146.326,-47.8 146.326,-83.8"/> | |
<text text-anchor="middle" x="81" y="-61.6" font-family="Times,serif" font-size="14.00">FishingRodbehavior</text> | |
</g> | |
<!-- FishingRodbehavior->Stick --> | |
<g id="GridCell_edge3" class="edge"><title>FishingRodbehavior->Stick</title> | |
<path fill="none" stroke="black" d="M146.453,-65.8C157.219,-65.8 168.039,-65.8 177.768,-65.8"/> | |
<polygon fill="black" stroke="black" points="187.842,-65.8 177.842,-70.3001 182.842,-65.8 177.842,-65.8001 177.842,-65.8001 177.842,-65.8001 182.842,-65.8 177.842,-61.3001 187.842,-65.8 187.842,-65.8"/> | |
</g> | |
<!-- Fish --> | |
<g id="GridCell/Fish" class="node"><title>Fish</title> | |
<polygon fill="#f0f8ff" stroke="black" points="108,-160.8 54,-160.8 54,-124.8 108,-124.8 108,-160.8"/> | |
<text text-anchor="middle" x="81" y="-138.6" font-family="Times,serif" font-size="14.00">Fish</text> | |
</g> | |
<!-- Bait->FishingRodbehavior --> | |
<g id="GridCell_edge6" class="edge"><title>Bait->FishingRodbehavior</title> | |
<path fill="none" stroke="black" d="M463.889,-39.9323C410.61,-34.636 285.639,-25.0548 182,-38.8 171.081,-40.2481 159.663,-42.5489 148.609,-45.2114"/> | |
<polygon fill="black" stroke="black" points="138.584,-47.7442 147.177,-40.9316 143.432,-46.5193 148.28,-45.2944 148.28,-45.2944 148.28,-45.2944 143.432,-46.5193 149.382,-49.6573 138.584,-47.7442 138.584,-47.7442"/> | |
</g> | |
</g> | |
</svg> | |
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient> | |
</XholonWorkbook> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment