Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active August 29, 2023 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenwebb/128c19254208c50508836463b468fca0 to your computer and use it in GitHub Desktop.
Save kenwebb/128c19254208c50508836463b468fca0 to your computer and use it in GitHub Desktop.
High-Rise Stairway System
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Tue Aug 29 2023 15:01:32 GMT-0400 (GMT-04:00)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: High-Rise Stairway System
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: 128c19254208c50508836463b468fca0
Keywords:
My Notes
--------
23 August 2023
In this workbook, I explore the stairway system in my high-rise condo building.
Along the way, I dabble in mathematics such as category theory, various sciences including climate change and pandemics, and anything else that suggests itself.
This may, or may not, be the first in a series inspired by living amongst high-rise systems.
At the start of the pandemic, I was concerned about taking the elevator, so I started walking up and down the many flights of stairs everyday.
I keep it up now because it's been such great exercise, especially for my legs.
Our stairway system, like most I imagine, is very stark, very functional. It serves a purpose. If there were a fire in the building, it lets people escape without having to take the heat-sensitive elevator system.
The building has 25 floors, labeled 1 to 25.
The three basement levels for parking and other common facilities, are labeled UD, ID, and LD. I believe these stand for Upper Dungeon, Intermediate Dungeon, and Lower Dungeon. They can be great for walking on rainy afternoons, and on the coldest days of winter.
The building has a Y shape, with a stairway at each of the three ends, labeled A, B, and C. I usually climb up or down using stairway C.
Each stairway is painted a uniform dull grey. Every landing has a bright light embedded in the wall, bright enough to sit on a step and read-by when we have a power outage.
An aside, but very much to the point: we are getting more strong storms that knock down trees in the area, and knock out the power.
Each residential floor (1 through 25) has 12 units, each with a different layout plan. The plans are labeled 08, 09, 10, 11
A few more features and quirks and thoughts:
- a sturdy continuous metal railing along the inside of each stairway, also painted the same color of grey
- the railing on the 7th floor landing has a quirky extra piece where I can set objects I'm carrying if I need to zip up a jacket or put on a hat before exiting at level 1 (GND).
- the stairs and landings are made of very solid concrete, just like the building itself
- kids play in the stairway sometimes
- the building staff doesn't always clean the stairs on a regular bases, although at the moment they're in good shape
- when I started climbing and descending the stairs in early 2020, I would feel a bit dizzy or light-headed. Not anymore.
- occasionally I meet someone else on the stairs, but less often than I would have thought, even during the pandemic
- walking up or down creates a lot of noise that you can hear inside a unit
- it reverberates ?
- the concrete readily transfers sound
- the metal railing can also be noisy if tapped
This aspires to be a Xholon model about "twoness" 0|1.
- for both Ojects and Morphisms
- focus on pairs ?
### Number of stairs in a stairway
Going up from a main landing:
5 + 6 small steps
+2 steps up to landings
---
13 up steppings
+2 (or +4?) steps on landings while turning
### TODO
- construct the building itself, as a Xholon/Binary Tree
- a static structure
- focus on twoness if possible
- can I connect this with my existing Elevator model?
- maybe run that in a separate browser window?
- create a custom avatar keymap ???
- use up and down arrows to move between floors
- use left and right arrows to move around on the current floor
- BUT this may be at odds with my other goals
- make the colors darker
- program some custom avatars and/or walkers
- they wander the Stairs and Floors
- one type could deliver packages from the Mail Room on GND
- print two sheets of paper, with large L and the other with large R
- photograph these placed at different locations in the stairs
- I may eventually want to call this project: Condo World
### Xholon2Svg
Svg Xholon.html:1:29040
1710:unit_3205 Xholon.html:1:29060
{"showStates":false,"nameTemplate":"R^^^^^","nameTemplate4Ports":"^^c_i^","fontFamily":"\"Courier New\",courier,monospace","fontSize":8,"fontSizeInc":1,"fontColor":"black","strokeWidth":1,"strokeWidthInc":0.05,"strokeColor":"#a121f1","shapeFillColor":"white","shapeFillColorAlternate":"#efffdf","shapeRx":-1,"shapeRy":-1,"pageWidth":990,"pageHeight":765,"shouldShowPorts":false,"portTemplate":"<rect id=\"%s\" x=\"%f\" y=\"%f\" ry=\"2.5\" width=\"6\" height=\"6\" fill=\"#0000ff\" stroke=\"#e0e0f8\" stroke-width=\"1px\"/>","portConjugatedTemplate":"<polygon id=\"%s\" points=\"0,0 0,6 6,3\" transform=\"translate(%f,%f)\" width=\"6\" height=\"6\" fill=\"#e0e0f8\" stroke=\"#0000ff\" stroke-width=\"1px\"/>","portCenterX":0,"portCenterY":0,"connectorStrokeColor":"black","connectorStrokeWidth":1,"shouldShowConnectors":false,"useInkscape":false,"shouldCommentConnectors":false,"shouldFlatten":false,"selectedNodesOnly":false,"shouldWriteStylesheet":false,"levelTranslateX":20,"levelTranslateY":20,"siblingTranslateX":2,"siblingTranslateY":0,"posMultiplier":2}
### supernext
var ava = xh.avatar();
ava.supernext = (avaa) => avaa.parent().parent().next().first().append(avaa.remove());
ava.supernext(ava);
//var ava = xh.avatar();
//console.log(ava.parent());
// -------------------------------------------------------------------------------------
// this works
//ava.supernext = (avaa) => avaa.parent().parent().next().first().append(avaa.remove());
//ava.supernext(ava);
// this works better
ava.supernext = (avaa) => {
const nparent = avaa.parent().next() || avaa.parent().parent().next().first();
nparent.append(avaa.remove())
};
ava.supernext(ava);
// ----------------------------------------------------------------------------------
// even better
ava.supernext = (avaa) => {
const nparent = avaa.parent().next() || avaa.parent().parent().next().first();
if (nparent) {
nparent.println(` Moving to ${nparent.name()}`);
nparent.append(avaa.remove())
}
};
ava.supernext(ava);
### References
(1) https://en.wikipedia.org/wiki/Tower_block
A tower block, high-rise, apartment tower, residential tower, apartment block, block of flats, or office tower is a tall building,
as opposed to a low-rise building and is defined differently in terms of height depending on the jurisdiction.
It is used as a residential, office building, or other functions including hotel, retail, or with multiple purposes combined.
Residential high-rise buildings are also known in some varieties of English, such as British English, as tower blocks and
may be referred to as MDUs, standing for multi-dwelling units.
A very tall high-rise building is referred to as a skyscraper.
(2) https://www.primordion.com/Xholon/gwt/wb/editwb.html?app=24a2abddbdc3eb068d6f5d9f59af9964&src=gist
The Island Game includes a lot of stuff that can be useful for this "High-Rise Stairway System" app.
(3) https://en.wikipedia.org/wiki/Stairs
KSW - this article defines all the terminology I'm using; but some of it is confusing or contradictory
stairs
step
stairway
flight of stairs
Stairs are a structure designed to bridge a large vertical distance between lower and higher levels by dividing it into smaller vertical distances.
This is achieved as a diagonal series of horizontal platforms called steps which enable passage to the other level by stepping from one to another step in turn.
stair - one step in a flight of stairs
stairs - a complete flight of steps between two floors
stair flight - a run of stairs or steps between landings
landing
Handrail
Stairs may also return onto themselves with 180° angle landings at each end of straight flights forming a vertical stairway commonly used in multistory and highrise buildings.
Flight: Any uninterrupted series of steps between floors or levels.
Landing, or platform: A landing is the area of a floor near the top or bottom step of a stair.
An intermediate landing is a small platform that is built as part of stairs between main floor levels and is typically used to allow the stairs to change directions,
or to allow the user a rest.
Stairway: This primarily American term is often reserved for the entire stairwell and staircase in combination; though often it is used interchangeably with "stairs" and "staircase".
Staircase tower: A tower attached to, or incorporated into, a building that contains stairs linking the various floors.
- KSW I could think of the codo stairwells as being 3 separate towers; logically, this is what they are
- access to the floors is possible only through the single door at each floor
- a door is the bi-directional port that connects a main landing to a corridor on the floor
see also: https://en.wikipedia.org/wiki/Staircase_tower
To avoid confusion, the number of steps in a set of stairs is always the number of risers, not the number of treads.
riser - The near-vertical element in a set of stairs, forming the space between one step and the next.
tread - The part of the stairway that is stepped on.
]]></Notes>
<_-.XholonClass>
<HighriseSystem/>
<Building>
<Highrise/>
</Building>
<Floor>
<ResidentialFloor/>
<GroundFloor/>
<Dungeon/>
</Floor>
<!--
Each Floor has three corridors that meet in the middle (the Hub) where the elevators are.
Each corridor has two ends:
- One end connects to the Door that leads to a MainLanding of a Stairway.
- The other end connects to the space (the Hub) where the three corridors come together.
-->
<Corridor/>
<!--
The central space on a Floor where the three corridors come together.
The Elevator doors are located here.
-->
<Hub/>
<Plan>
<Plan01/>
<Plan02/>
<Plan03/>
<Plan04/>
<Plan05/>
<Plan06/>
<Plan07/>
<Plan08/>
<Plan09/>
<Plan10/>
<Plan11/>
<Plan12/>
</Plan>
<Plans/>
<System>
<StairwaySystem/>
</System>
<Stairway superClass="Script"/>
<FlightOfStairs/>
<!--<Stair/>-->
<Landing>
<MainLanding/>
<IntermediateLanding/>
</Landing>
<Step>
<Step5/>
<Step6/>
</Step>
<Handrail/>
<!--
A Door is represnted as an actual space/location/object.
It controls the flow of people and other active objects back and forth between two other spaces.
A Door contains a simple State Machine with two states Closed|Open == 0|1.
A Door has a DoorKnob that acts like a Button that toggles between the two states.
People know how to open and close doors. Animals (dogs, cats, aardvarks, zebras) do not know how to do this.
Some doors are self-closing.
Some doors have a second state Locked|Unlocked == 0|1.
-->
<Door>
<ElevatorDoor/>
</Door>
<Floors superClass="Script"/>
<Plans superClass="Script"/>
<!--
A unit is a residential apartment in the condo building.
A unit is labeled by concatenating the floor with the plan.
For example, unit 1511 is an instance of Plan11 on floor 15.
The unit lael is thus a product of two sets, the set of ResidentialFloor numbers, and the set of Plan numbers.
For example Floor x Plan :
floors
x 2 3 4 5 6 7 8 9 10 11 12
p 08 208 308 408 508 608 708 808 908 1008 1108 1208
l 09 209
a 10 210
n 11 211
s
-->
<Unit/>
<Units/>
<Room>
<!-- each condo unit has multiple rooms -->
<UnitRoom>
<!-- every condo unit has at least these rooms -->
<Entrance/>
<Kitchen/>
<Bathroom/>
<Bedroom/>
<LivingRoom/>
<Balcony/>
<Hallway/>
<!-- a condo unit may have these additional rooms -->
<DiningRoom/>
<Den/>
<Closet/>
<Office/>
</UnitRoom>
<!-- the condo building has many rooms that are common to more than one unit -->
<CommonRoom>
<!-- TODO figure out how to generate this in GroundFloor; should it be a Script? -->
<MailRoom superClass="Script"/>
<!-- each residential floor has these two rooms -->
<GarbageRoom/>
<ElectricalRoom/>
</CommonRoom>
</Room>
<CommonRooms/>
<FloorStairConnectorUpper superClass="Script"/>
<CorridorUnitConnectorUpper superClass="Script"/>
<!-- Avatar Subtrees; must be a GWT behavior; use Avatar apply command -->
<Supernext superClass="Script"/>
<Superprev superClass="Script"/>
</_-.XholonClass>
<xholonClassDetails>
<Chameleon><Color>white</Color></Chameleon>
<HighriseSystem><Color>white</Color></HighriseSystem>
<Highrise><Color>white</Color></Highrise>
<Floors><Color>white</Color></Floors>
<Avatar><Color>rgba(255,0,0,1.0)</Color></Avatar>
<!-- enable ports -->
<Door xhType="XhtypePureActiveObject"/>
<MainLanding xhType="XhtypePureActiveObject"/>
<Unit xhType="XhtypePureActiveObject"/>
<Entrance xhType="XhtypePureActiveObject"/>
<Supernext><DefaultContent><![CDATA[
var me, ava, beh = {
postConfigure: function() {
me = this.cnode;
ava = $wnd.xh.avatar();
},
processReceivedSyncMessage: function(msg) {
var data = msg.data; // data is an Array
const typeName = data[0].xhc().name();
/*var str = "Supernext received message";
if (data && (data.length)) {
for (var i = 0; i < data.length; i++) {
str += " " + data[i];
}
}*/
switch(typeName) {
case "Step6":
ava.action("exit;next;enter;");
break;
default:
ava.action("next");
break;
}
return null;
}
}
//# sourceURL=Supernext.js
]]></DefaultContent></Supernext>
<Superprev><DefaultContent><![CDATA[
var me, ava, beh = {
postConfigure: function() {
me = this.cnode;
ava = $wnd.xh.avatar();
},
processReceivedSyncMessage: function(msg) {
var data = msg.data; // data is an Array
const typeName = data[0].xhc().name();
/*var str = "Superprev received message";
if (data && (data.length)) {
for (var i = 0; i < data.length; i++) {
str += " " + data[i];
}
}*/
switch(typeName) {
case "MainLanding":
ava.action("exit;prev;enter;next;next;next");
break;
default:
ava.action("prev");
break;
}
return null;
}
}
//# sourceURL=Supernext.js
]]></DefaultContent></Superprev>
<Stairway><DefaultContent><![CDATA[
const labels="LD,ID,UD,GND,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25".trim().split(",");
var me, beh = {
postConfigure: function() {
me = this.cnode;
labels.forEach((label, ix) => me.append(this.floor(this.type(label), label, this.scrpt()) ));
},
floor: function(type, label, scrpt) {
return `<${type} roleName="${label}"><script>${scrpt}</script></${type}>`;
},
type: function(label) {
return "FlightOfStairs";
},
scrpt: function() {
return `const defaultContent = this.parent().xhc().attr("DefaultContent");if (defaultContent) {this.parent().append(defaultContent);}`;
}
}
//# sourceURL=StairwayDc.js
]]></DefaultContent></Stairway>
<!-- generate all floors in the building .k .attr("DefaultContent") -->
<Floors>
<DefaultContent><![CDATA[
const labels="LD,ID,UD,GND,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25".trim().split(",");
const colors="indigo,brown,darkred,green,green".trim().split(",");
const defaultColor = colors[4];
var me, beh = {
postConfigure: function() {
me = this.cnode;
labels.forEach((label, ix) => me.append(this.floor(this.type(label), label, colors[ix] ? colors[ix] : defaultColor, this.scrpt()) ));
},
floor: function(type, label, color, scrpt) {
return `<${type} roleName="${label}"><Color>${color}</Color><script>${scrpt}</script></${type}>`;
},
type: function(label) {
return label[1] === "D" ? "Dungeon"
: label === "GND" ? "GroundFloor"
: "ResidentialFloor";
},
scrpt: function() {
return `const defaultContent = this.parent().xhc().attr("DefaultContent");if (defaultContent) {this.parent().append(defaultContent);}`;
}
}
//# sourceURL=FloorsDc.js
]]></DefaultContent>
</Floors>
<!-- the ResidentialFloor DefaultContent has no effect; maybe use ResidentialFloorbehavior ??? NO; I added a script to Floors DefaultContent -->
<ResidentialFloor><DefaultContent><![CDATA[
<_-.floor>
<Hub>
<Door roleName="toGarbageRoom"/>
<Door roleName="toElectricalRoom"/>
<ElevatorDoor multiplicity="4"/>
<CommonRooms>
<GarbageRoom/>
<ElectricalRoom/>
</CommonRooms>
</Hub>
<Corridor roleName="A">
<Door roleName="toStairway"/>
<Door roleName="toUnit" multiplicity="4"/>
<Units>
<Unit multiplicity="4"/>
</Units>
</Corridor>
<Corridor roleName="B">
<Door roleName="toStairway"/>
<Door roleName="toUnit" multiplicity="4"/>
<Units>
<Unit multiplicity="4"/>
</Units>
</Corridor>
<Corridor roleName="C">
<Door roleName="toStairway"/>
<Door roleName="toUnit" multiplicity="4"/>
<Units>
<Unit multiplicity="4"/>
</Units>
</Corridor>
<Script>
// number the units
const floor = this.parent();
const planNums = "01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25".trim().split(",");
//console.log(floor.name() + " numbering the units");
var planNumIx = 0;
var corridor = floor.first().next();
while (corridor) {
//console.log("numbering corridor " + corridor.name());
if ((corridor.xhc().name() == "Corridor")) {
var unit = corridor.last().first();
while (unit) {
const planNum = planNums[planNumIx++];
unit.role(floor.role() + planNum);
const plan = floor.xpath(`../../Plans/Plan${planNum}`, floor);
unit.append(plan.xhc().attr("DefaultContent"));
unit = unit.next();
}
}
corridor = corridor.next();
}
//# sourceURL=UnitNumbering.js
</Script>
</_-.floor>
]]></DefaultContent></ResidentialFloor>
<Plan01><DefaultContent><![CDATA[
<_-.plan>
<Entrance/>
<Kitchen/>
<Bathroom/>
<Bedroom/>
<LivingRoom/>
</_-.plan>
]]></DefaultContent></Plan01>
<Plan02><DefaultContent><![CDATA[
<_-.plan>
<Entrance/>
<Kitchen/>
<Bathroom/>
<Bedroom/>
<LivingRoom/>
</_-.plan>
]]></DefaultContent></Plan02>
<Plan03><DefaultContent><![CDATA[
<_-.plan>
<Entrance/>
<Kitchen/>
<Bathroom/>
<Bedroom/>
<LivingRoom/>
</_-.plan>
]]></DefaultContent></Plan03>
<Plan04><DefaultContent><![CDATA[
<_-.plan>
<Entrance/>
<Kitchen/>
<Bathroom/>
<Bedroom/>
<LivingRoom/>
</_-.plan>
]]></DefaultContent></Plan04>
<Plan05><DefaultContent><![CDATA[
<_-.plan>
<Entrance/>
<Kitchen/>
<Bathroom/>
<Bedroom/>
<LivingRoom/>
</_-.plan>
]]></DefaultContent></Plan05>
<Plan06><DefaultContent><![CDATA[
<_-.plan>
<Entrance/>
<Kitchen/>
<Bathroom/>
<Bedroom/>
<LivingRoom/>
</_-.plan>
]]></DefaultContent></Plan06>
<Plan07><DefaultContent><![CDATA[
<_-.plan>
<Entrance/>
<Kitchen/>
<Bathroom/>
<Bedroom/>
<LivingRoom/>
</_-.plan>
]]></DefaultContent></Plan07>
<Plan08><DefaultContent><![CDATA[
<_-.plan>
<Entrance/>
<Kitchen/>
<Bathroom/>
<Bedroom/>
<LivingRoom/>
</_-.plan>
]]></DefaultContent></Plan08>
<Plan09><DefaultContent><![CDATA[
<_-.plan>
<Entrance/>
<Kitchen/>
<Bathroom/>
<Bedroom/>
<LivingRoom/>
</_-.plan>
]]></DefaultContent></Plan09>
<Plan10><DefaultContent><![CDATA[
<_-.plan>
<Entrance>
<Light/>
</Entrance>
<Closet/>
<DiningRoom/>
<Den/>
<Balcony/>
<LivingRoom>
<Book/>
<Pico/>
</LivingRoom>
<Kitchen>
<Apple/>
<Bowl/>
</Kitchen>
<Hallway/>
<Bathroom>
<Water/>
</Bathroom>
<Office/>
<Office/>
<Bedroom>
<Socks/>
</Bedroom>
<Closet/>
<Bathroom/>
<Balcony/>
</_-.plan>
]]></DefaultContent></Plan10>
<Plan11><DefaultContent><![CDATA[
<_-.plan>
<Entrance/>
<Kitchen/>
<Bathroom/>
<Bedroom/>
<LivingRoom/>
</_-.plan>
]]></DefaultContent></Plan11>
<Plan12><DefaultContent><![CDATA[
<_-.plan>
<Entrance/>
<Kitchen/>
<Bathroom/>
<Bedroom/>
<LivingRoom/>
</_-.plan>
]]></DefaultContent></Plan12>
<!-- for now I just have 1 step (multiplicity="1") the lower multiplicity should be 6 and the higher 5 -->
<FlightOfStairs><DefaultContent><![CDATA[
<_-.flight>
<MainLanding/>
<Step5 multiplicity="1"/> <!-- + <<Handrail/> ? -->
<IntermediateLanding/>
<Step6 multiplicity="1"/> <!-- + <<Handrail/> ? -->
</_-.flight>
]]></DefaultContent></FlightOfStairs>
<FloorStairConnectorUpper><DefaultContent><![CDATA[
var me, beh = {
postConfigure: function() {
me = this.cnode;
console.log("FloorStairConnectorUpper");
const floors = me.xpath("../Highrise/Floors", me);
console.log(floors.name());
const stairwaySystem = me.xpath("../Highrise/StairwaySystem", me);
console.log(stairwaySystem.name());
const floorsarr = this.collectFloors(floors);
console.log(floorsarr);
const stairsarr = this.collectStairways(stairwaySystem);
console.log(stairsarr);
// connect floors and stairs for each corridor and stairway
this.doStairway(floorsarr, stairsarr[0], 1);
this.doStairway(floorsarr, stairsarr[1], 2);
this.doStairway(floorsarr, stairsarr[2], 3);
},
collectFloors: function(floors) {
const arr = [];
var node = floors.first();
while(node) {
arr.push(node);
node = node.next();
}
return arr;
},
collectStairways: function(stairwaySystem) {
const arr = [];
var node = stairwaySystem.first();
while(node) {
arr.push(node);
node = node.next();
}
return arr;
},
doStairway: function(floorsarr, stairway, corridorNum) {
let snode = stairway.first();
let findex = 0;
while (snode) {
let floor = floorsarr[findex];
let corridor = floor.xpath(`./Corridor[${corridorNum}]`, floor);
//me.println(`s ${snode.name()} f ${floor} ${corridor}`);
if (corridor) {
let mainLanding = snode.xpath("./MainLanding", snode);
let stairwayDoor = corridor.xpath("./Door[@roleName='toStairway']", corridor);
//me.println(`s ${mainLanding} f ${stairwayDoor}`);
mainLanding.port(0, stairwayDoor);
stairwayDoor.port(0, mainLanding);
//console.log(mainLanding, stairwayDoor);
}
snode = snode.next();
findex++;
}
}
}
//# sourceURL=FloorStairCnUp.js
]]></DefaultContent></FloorStairConnectorUpper>
<CorridorUnitConnectorUpper><DefaultContent><![CDATA[
var me, beh = {
postConfigure: function() {
me = this.cnode;
console.log("CorridorUnitConnectorUpper TODO");
const floors = me.xpath("../Highrise/Floors", me);
console.log(floors.name());
const floorsarr = this.collectFloors(floors);
console.log(floorsarr);
// connect floors and stairs for each corridor and stairway
this.doFloors(floorsarr, 1);
this.doFloors(floorsarr, 2);
this.doFloors(floorsarr, 3);
},
collectFloors: function(floors) {
const arr = [];
var node = floors.first();
while(node) {
arr.push(node);
node = node.next();
}
return arr;
},
doFloors: function(floorsarr, corridorNum) {
me.println(`doFloors ${floorsarr.length} ${corridorNum}`);
let findex = 0;
while (findex < floorsarr.length) {
let floor = floorsarr[findex];
let corridor = floor.xpath(`./Corridor[${corridorNum}]`, floor);
//me.println(`f ${floor} ${corridor}`);
if (corridor) {
let units = corridor.xpath("Units", corridor);
let unit = units.first();
let unitDoorIndex = 1;
while (unit) {
let unitDoor = corridor.xpath(`./Door[@roleName='toUnit'][${unitDoorIndex}]`, corridor);
//me.println(`u ${units.name()} ${unit} ${unitDoor}`);
const entrance = unit.xpath("Entrance", unit);
if (entrance) {
entrance.port(0, unitDoor);
unitDoor.port(0, entrance);
} else {
unit.port(0, unitDoor);
unitDoor.port(0, unit);
}
//console.log(unit, unitDoor);
unit = unit.next();
unitDoorIndex++;
}
}
findex++;
}
}
}
//# sourceURL=CorrUnitCnUp.js
]]></DefaultContent></CorridorUnitConnectorUpper>
</xholonClassDetails>
<HighriseSystem>
<!-- see Xml2Xholon - DefaultContent only works if I include RoomModel somewhere before I need to use DefaultContent -->
<RoomModel/>
<Highrise>
<Floors/>
<StairwaySystem>
<Stairway roleName="A"/>
<Stairway roleName="B"/>
<Stairway roleName="C"/>
</StairwaySystem>
<!-- testing -->
<Plans>
<Plan01/>
<Plan02/>
<Plan03/>
<Plan04/>
<Plan05/>
<Plan06/>
<Plan07/>
<Plan08/>
<Plan09/>
<Plan10/>
<Plan11/>
<Plan12/>
</Plans>
</Highrise>
<FloorStairConnectorUpper/>
<CorridorUnitConnectorUpper/>
<Animate selection="#xhgraph" xpath="./HighriseSystem/Highrise/StairwaySystem" duration="1" cssStyle="stroke-width: {0px;}" efParams="{&quot;selection&quot;:&quot;#xhgraph&quot;,&quot;sort&quot;:&quot;disable&quot;,&quot;width&quot;:500,&quot;height&quot;:500,&quot;mode&quot;:&quot;tween&quot;,&quot;labelContainers&quot;:false,&quot;includeId&quot;:true,&quot;shape&quot;:&quot;circle&quot;,&quot;useIcons&quot;:true,&quot;maxChars&quot;:1,&quot;togglePortColors&quot;:false,&quot;supportTouch&quot;:false,&quot;supportClick&quot;:false,&quot;supportContextmenu&quot;:false,&quot;supportDblclick&quot;:false,&quot;fontSizeMultiplier&quot;:2.6}"/>
</HighriseSystem>
<HighriseSystembehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
// commands for built-in Avatar Island Game
var akmIG = '{ \
"SHIFT":"true", \
"NOSCROLL":"true", \
"UP":"go port0;become this incognita n;if xpath(Avatar/ancestor::OceanCell) go port2;become this energy --;ifeq xpath(Avatar) energy 0 go xpath(ancestor::IslandSystem/GameOver);", \
"DOWN":"go port2;become this incognita n;if xpath(Avatar/ancestor::OceanCell) go port0;become this energy --;ifeq xpath(Avatar) energy 0 go xpath(ancestor::IslandSystem/GameOver);", \
"LEFT":"go port3;become this incognita n;if xpath(Avatar/ancestor::OceanCell) go port1;become this energy --;ifeq xpath(Avatar) energy 0 go xpath(ancestor::IslandSystem/GameOver);", \
"RIGHT":"go port1;become this incognita n;if xpath(Avatar/ancestor::OceanCell) go port3;become this energy --;ifeq xpath(Avatar) energy 0 go xpath(ancestor::IslandSystem/GameOver);", \
"d":"become this menu drop", \
"e":"become this menu eat", \
"f":"follow nextprev", \
"F":"unfollow", \
"m":"become this menu menu", \
"n":"enter nextprev", \
"p":"pause;become this menu menu", \
"r":"become this menu recipe", \
"s":"step", \
" ":"step", \
"t":"become this menu take", \
"x":"if xpath(../../FieldRow) wait else exit", \
"z":"param transcript toggle;", \
"<":"flip prev", \
">":"flip next", \
",":"flip prev", \
".":"flip next", \
"?":"help keymap", \
"/":"help commands", \
"[":"become this stroke left;apply subtree(ToolsST)Paddle to context;become this energy --;ifeq xpath(Avatar) energy 0 go xpath(ancestor::IslandSystem/GameOver);", \
"]":"become this stroke right;apply subtree(ToolsST)Paddle to context;become this energy --;ifeq xpath(Avatar) energy 0 go xpath(ancestor::IslandSystem/GameOver);", \
"0":"go link0;pause;become this menu menu", \
"1":"go link1;pause;become this menu menu", \
"2":"go link2;pause;become this menu menu", \
"3":"go link3;pause;become this menu menu", \
"4":"go link4;pause;become this menu menu", \
"5":"go link5;pause;become this menu menu", \
"$":"become this menu exportdata" \
}';
// the following is the built-in avatar key map plus [ and ]
var akm = `{
"NOSCROLL":"true",
"0":"go link0",
"1":"go link1",
"2":"go link2",
"3":"go link3",
"4":"go link4",
"5":"go link5",
"6":"go link6",
"7":"go link7",
"8":"go link8",
"9":"go link9",
"UP":"exit",
"DOWN":"first",
"LEFT":"prev",
"RIGHT":"next",
"A":"appear",
"D":"drop",
"E":"eat",
"F":"flip",
"H":"go history",
"BACKSPACE":"back",
"I":"inventory",
"L":"look",
"N":"anim this hop",
"P":"pause",
"R":"start",
"S":"step",
"T":"take",
"V":"vanish",
"W":"who;where",
"X":"exit;next;first",
"Y":"if xpath(Avatar/ancestor::Step6) exit;next;enter; else next",
"]":"apply subtree(ToolsST)Supernext to context",
"[":"apply subtree(ToolsST)Superprev to context"
}`;
// "M":"build <Animate\tselection='#xhgraph'/>", ERROR
//akm["M"] = "build <Animate\tselection='#xhgraph'/>";
$wnd.xh.avatarKeyMap(akm);
//console.log("doing ava ...");
var ava = $wnd.xh.avatar();
//ava.action("param debug true");
// Subtrees - based on Island Game
ava.action("param subtrees true EdibleST,WaterST,ToolsST,BehaviorsST,MaterialsST");
console.log("doing ava 1");
// TODO has error
const superNP = (ava, xhcName) => {
ava.action(`build Super${xhcName};take super${xhcName}`);
var snp = ava.last();
var snpST = null;
console.log('ava["subtrees"]', ava["subtrees"]);
if (ava["subtrees"]) {
snpST = ava.subtrees['ToolsST'];
}
console.log(snp, snpST);
if (snp && snpST) {
snpST.append(snp.remove()); // move the instance of Supernext or Superprev into the ToolsST subtree
}
else {
console.log(`s${xhcName} does not exist`);
//snp.remove();
}
return;
}
// Supernext
superNP(ava, "next");
/*ava.action("build Supernext;");
//console.log(ava.last());
ava.action("take supernext");
var snext = ava.last();
var snextST = null;
//console.log('ava["subtrees"]', ava["subtrees"]);
if (ava["subtrees"]) {
snextST = ava.subtrees['ToolsST'];
}
//console.log(snext, snextST);
if (snext && snextST) {
snextST.append(snext.remove()); // move the instance of Supernext into the ToolsST subtree
}
else {
console.log("snext does not exist");
//snext.remove();
}*/
// Superprev
superNP(ava, "prev");
/*ava.action("build Superprev;");
//console.log(ava.last());
ava.action("take superprev");
var sprev = ava.last();
var sprevST = null;
//console.log('ava["subtrees"]', ava["subtrees"]);
if (ava["subtrees"]) {
sprevST = ava.subtrees['ToolsST'];
}
//console.log(sprev, sprevST);
if (sprev && sprevST) {
sprevST.append(sprev.remove()); // move the instance of Superprev into the ToolsST subtree
}
else {
console.log("sprev does not exist");
//snext.remove();
}*/
//console.log("doing ava 3");
ava.action('step');
ava.action("enter;enter;enter;next;enter;next;next;enter;next;next;next;next;enter;appear");
//console.log("... finished ava");
//console.log(ava);
/*ava.supernext = (avaa) => {
const nparent = avaa.parent().next() || avaa.parent().parent().next().first();
if (nparent) {
nparent.println(` Moving to ${nparent.name()}`);
nparent.append(avaa.remove())
}
};*/
// usage
//ava.supernext(ava);
//# sourceURL=HighriseSystembehavior.js
]]></HighriseSystembehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>StairwaySystem</title>
<rect id="HighriseSystem/Highrise/StairwaySystem" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<g>
<title>Stairway A</title>
<rect id="HighriseSystem/Highrise/StairwaySystem/Stairway" fill="#6AB06A" height="50" width="10" x="80" y="0"/>
</g>
</g>
</svg>
<svg id="svg1693069272816" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="200" height="150">
<title>High-Rise Stairway System</title>
<g id="toplevelgroup" transform="translate(0,0) scale(1) rotate(0)">
<g id="g1">
<title>1710:unit_3205 []</title>
<rect id="Unit[@roleName='1710']" x="10" y="10" width="40" height="50" fill="#efffdf" stroke="#a121f1" stroke-width="1px"/>
<text id="text2" x="15" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">1710</text>
</g>
<g transform="translate(20,20)">
<g id="g3">
<title>entrance_3273 [ port:toUnit:door_3200]</title>
<rect id="Unit[@roleName='1710']/Entrance" x="10" y="10" width="56" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text4" x="15" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Entrance</text>
</g>
<g id="g5">
<title>light_3274 []</title>
<rect id="Unit[@roleName='1710']/Entrance/Light" x="20" y="30" width="40" height="20" fill="#efffdf" stroke="#a121f1" stroke-width="1px"/>
<text id="text6" x="25" y="40" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Light</text>
</g>
</g>
<g transform="translate(20,20)">
<g id="g7">
<title>closet_3275</title>
<rect id="Unit[@roleName='1710']/Closet[1]" x="12" y="10" width="42" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text8" x="17" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Closet</text>
</g>
</g>
<g transform="translate(20,20)">
<g id="g9">
<title>diningRoom_3276</title>
<rect id="Unit[@roleName='1710']/DiningRoom" x="14" y="10" width="70" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text10" x="19" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">DiningRoom</text>
</g>
</g>
<g transform="translate(20,20)">
<g id="g11">
<title>den_3277</title>
<rect id="Unit[@roleName='1710']/Den" x="16" y="10" width="40" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text12" x="21" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Den</text>
</g>
</g>
<g transform="translate(20,20)">
<g id="g13">
<title>balcony_3278</title>
<rect id="Unit[@roleName='1710']/Balcony[1]" x="18" y="10" width="49" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text14" x="23" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Balcony</text>
</g>
</g>
<g transform="translate(20,20)">
<g id="g15">
<title>livingRoom_3279</title>
<rect id="Unit[@roleName='1710']/LivingRoom" x="20" y="10" width="70" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text16" x="25" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">LivingRoom</text>
</g>
<g id="g17">
<title>book_3280 []</title>
<rect id="Unit[@roleName='1710']/LivingRoom/Book" x="20" y="30" width="40" height="20" fill="#efffdf" stroke="#a121f1" stroke-width="1px"/>
<text id="text18" x="25" y="40" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Book</text>
</g>
<g id="g19">
<title>pico_3281 []</title>
<rect id="Unit[@roleName='1710']/LivingRoom/Pico" x="22" y="30" width="40" height="20" fill="#efffdf" stroke="#a121f1" stroke-width="1px"/>
<text id="text20" x="27" y="40" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Pico</text>
</g>
</g>
<g transform="translate(20,20)">
<g id="g21">
<title>kitchen_3282</title>
<rect id="Unit[@roleName='1710']/Kitchen" x="22" y="10" width="49" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text22" x="27" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Kitchen</text>
</g>
<g id="g23">
<title>apple_3283 []</title>
<rect id="Unit[@roleName='1710']/Kitchen/Apple" x="20" y="30" width="40" height="20" fill="#efffdf" stroke="#a121f1" stroke-width="1px"/>
<text id="text24" x="25" y="40" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Apple</text>
</g>
<g id="g25">
<title>bowl_3284 []</title>
<rect id="Unit[@roleName='1710']/Kitchen/Bowl" x="22" y="30" width="40" height="20" fill="#efffdf" stroke="#a121f1" stroke-width="1px"/>
<text id="text26" x="27" y="40" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Bowl</text>
</g>
</g>
<g transform="translate(20,20)">
<g id="g27">
<title>hallway_3285</title>
<rect id="Unit[@roleName='1710']/Hallway" x="24" y="10" width="49" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text28" x="29" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Hallway</text>
</g>
</g>
<g transform="translate(20,20)">
<g id="g29">
<title>bathroom_3286</title>
<rect id="Unit[@roleName='1710']/Bathroom[1]" x="26" y="10" width="56" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text30" x="31" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Bathroom</text>
</g>
<g id="g31">
<title>water_3287 []</title>
<rect id="Unit[@roleName='1710']/Bathroom[1]/Water" x="20" y="30" width="40" height="20" fill="#efffdf" stroke="#a121f1" stroke-width="1px"/>
<text id="text32" x="25" y="40" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Water</text>
</g>
</g>
<g transform="translate(20,20)">
<g id="g33">
<title>office_3288</title>
<rect id="Unit[@roleName='1710']/Office[1]" x="28" y="10" width="42" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text34" x="33" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Office</text>
</g>
</g>
<g transform="translate(20,20)">
<g id="g35">
<title>office_3289</title>
<rect id="Unit[@roleName='1710']/Office[2]" x="30" y="10" width="42" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text36" x="35" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Office</text>
</g>
</g>
<g transform="translate(20,20)">
<g id="g37">
<title>bedroom_3290</title>
<rect id="Unit[@roleName='1710']/Bedroom" x="32" y="10" width="49" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text38" x="37" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Bedroom</text>
</g>
<g id="g39">
<title>socks_3291 []</title>
<rect id="Unit[@roleName='1710']/Bedroom/Socks" x="20" y="30" width="40" height="20" fill="#efffdf" stroke="#a121f1" stroke-width="1px"/>
<text id="text40" x="25" y="40" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Socks</text>
</g>
</g>
<g transform="translate(20,20)">
<g id="g41">
<title>closet_3292</title>
<rect id="Unit[@roleName='1710']/Closet[2]" x="34" y="10" width="42" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text42" x="39" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Closet</text>
</g>
</g>
<g transform="translate(20,20)">
<g id="g43">
<title>bathroom_3293</title>
<rect id="Unit[@roleName='1710']/Bathroom[2]" x="36" y="10" width="56" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text44" x="41" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Bathroom</text>
</g>
</g>
<g transform="translate(20,20)">
<g id="g45">
<title>balcony_3294</title>
<rect id="Unit[@roleName='1710']/Balcony[2]" x="38" y="10" width="49" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text46" x="43" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Balcony</text>
</g>
</g>
<g transform="translate(20,20)">
<g id="g47">
<title>avatar_42</title>
<rect id="Unit[@roleName='1710']/Avatar" x="40" y="10" width="42" height="50" fill="white" stroke="#a121f1" stroke-width="1px"/>
<text id="text48" x="45" y="20" font-family=""Courier New",courier,monospace" font-size="8" fill="black">Avatar</text>
</g>
</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