Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active September 15, 2021 15:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save kenwebb/4a744302126c5e36f8ef4d56bbd35567 to your computer and use it in GitHub Desktop.
Mars Template
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Wed Sep 15 2021 11:21:01 GMT-0400 (Eastern Daylight Time)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Mars Template
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: 4a744302126c5e36f8ef4d56bbd35567
Keywords:
My Notes
--------
September 12, 2021
https://www.primordion.com/Xholon/gwt/Xholon.html?app=Mars+Template&src=lstr&gui=clsc
https://www.primordion.com/Xholon/gwt/Xholon.html?app=Mars+Template&src=lstr&gui=clsc&xhp=49,49,f4a460
https://www.primordion.com/Xholon/gwt/Xholon.html?app=Mars+Template&src=lstr&gui=none&xhp=49,49,f4a460
https://www.primordion.com/Xholon/gwt/Xholon.html?app=4a744302126c5e36f8ef4d56bbd35567&src=gist&gui=none&jslib=FreeformText2XmlString&xhp=49,49,f4a460
http://127.0.0.1:8080/war/Xholon.html?app=4a744302126c5e36f8ef4d56bbd35567&src=gist&gui=clsc&xhp=49,49,f4a460
http://127.0.0.1:8080/war/Xholon.html?app=4a744302126c5e36f8ef4d56bbd35567&src=gist&gui=clsc&jslib=FreeformText2XmlString&xhp=49,49,f4a460
colors
------
https://www.w3schools.com/cssref/css_colors.asp
iief
----
(() => ($wnd.xh.root().println("testing")))()
((txt) => ($wnd.xh.root().println(txt)))("testing b")
(() => ($wnd.xh.root().println(this.parent().name())))()
((cell) => ($wnd.xh.root().println(cell.name())))(this.parent())
((ava) => (ava.action("next")))($wnd.xh.avatar())
iief better
-----------
((ava => ava.action("next"))($wnd.xh.avatar()))
NASA images
-----------
https://photojournal.jpl.nasa.gov/catalog/PIA05108
https://photojournal.jpl.nasa.gov/jpegMod/PIA05108_modest.jpg
PIA05108_modest.jpg
September 15, 2021
------------------
/**
luke01.js
Ken Webb
September 14, 2021
This is designed to run in Dev Tools, for the Mars Template (or similar) model.
*/
(() => {
const compose = (...fns) => x => fns.reduceRight((y, f) => f(y), x)
const pipe = (...fns) => x => fns.reduce((y, f) => f(y), x)
const north = (avatar) => avatar.action("go 0")
const east = (avatar) => avatar.action("go 1")
const south = (avatar) => avatar.action("go 2")
const west = (avatar) => avatar.action("go 3")
const ne = (avatar) => pipe(north, east)(avatar)
const se = (avatar) => pipe(south, east)(avatar)
const sw = (avatar) => pipe(south, west)(avatar)
const nw = (avatar) => pipe(north, west)(avatar)
const color = (prop) => (avatar) => avatar.color(prop)
const build = (thing) => (avatar) => avatar.action(`build ${thing}`)
const ava = xh.avatar()
//console.log(ava.name())
color("pink")(ava)
//console.log(east(ava).name())
//east(ava)
//ne(ava)
sw(ava)
build("Rock")(ava)
west(ava)
pipe(east, build("Rock"), north, south, south, color("purple"))(ava)
})()
]]></Notes>
<_-.XholonClass>
<PhysicalSystem/>
<LandCell/>
<Rock/>
</_-.XholonClass>
<xholonClassDetails>
<Rock><Color>black</Color></Rock>
</xholonClassDetails>
<PhysicalSystem>
<!-- Avatar -->
<script>
// commands for built-in Avatar
var akm = '{ \
"SHIFT":"true", \
"NOSCROLL":"true", \
"UP":"go 0", \
"DOWN":"go 2", \
"LEFT":"prev", \
"RIGHT":"next", \
"d":"drop first", \
"e":"eat first", \
"f":"flip", \
"i":"inventory", \
"l":"look", \
"n":"enter nextprev", \
"p":"pause", \
"s":"step", \
" ":"step", \
"t":"take nextprev", \
"w":"who;where", \
"z":"param transcript toggle;", \
"?":"help keymap" \
}';
$wnd.xh.avatarKeyMap(akm);
const ava = $wnd.xh.avatar()
ava.action("who;enter;where;enter;next;enter;enter;where;appear")
//# sourceURL=script1.js
</script>
<!-- GridGenerator -->
<script>
const XHP_DEFAULT = "21,21,aa9988";
const search = new URLSearchParams($wnd.location.search);
const xhp = search.get("xhp") ? search.get("xhp").split(",") : XHP_DEFAULT.split(",");
const gg = `
&lt;GridGenerator
rows="${xhp[0]}"
cols="${xhp[1]}"
gridType="Gvt"
names="Environment,FieldRow,LandCell"
columnColor="${xhp[2]}"
gridViewerParams="PhysicalSystem/Environment,10,Island Viewer,true"
cellsCanSupplyOwnColor="true"&gt;
&lt;/GridGenerator&gt;
`;
this.parent().append(gg.trim());
//# sourceURL=script2.js
</script>
</PhysicalSystem>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<!--<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Block</title>
<rect id="PhysicalSystem/Block" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<g>
<title>Height</title>
<rect id="PhysicalSystem/Block/Height" fill="#6AB06A" height="50" width="10" x="80" y="0"/>
</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