Beasts run amok - Nice kitty.

Created by kenwebb on June 14, 2010. Votes: 17 Views: 428 Vote for this app. Tags: cats

Once the app is launched with Java Web Start, open it by selecting File --> Open from the menu. Then select Controller --> Start from the tree.

In the Bestiary sample Xholon app, beasts exist in a grid and perform various behaviors. Read more about Licorice, the green-eyed black cat (colored green on the Bestiary grid).

Bestiary Patterns - Houses

Created by kenwebb on June 14, 2010. Votes: 12 Vote for this subtree. Tags: xml

You can paste houses into the Grid node, or directly into any grid cell. Here's an example of a house that can be copied and pasted. A bestiary pattern can have (W)alls, (D)oors, (P)orches, (E)ntrances, (.) house interior sections, and (_) outside fills. The pattern may include x and y coordinate values, but these are only used if the pattern is pasted into the Grid (ex: grid_492) node.
To paste a pattern into the grid: Pause the simulation by clicking Controller --> Pause, Select all of the following text between and including the BestiaryPattern start and end tags, Copy the text to the clipboard, Move the mouse inside the grid, Right-click on a location in the grid and select Edit --> Paste Last Child, Unpause the simulation by clicking Pause again.
To toggle a door between being opened and closed, just click on the door in the grid. Some beasts can move through closed doors, and others can't.
It's not strictly necessary to pause and unpause, but if you don't then the popup menu usually is immediately erased by the objects in the simulation.

<BestiaryPattern x="10" y="10">
_WWWWW
_W...W
PDE..W
_W...W
_WWWWW
</BestiaryPattern>

A larger house

Created by kenwebb on June 14, 2010. Votes: 12 Vote for this subtree. Tags: xml

This is a larger house with more doors.

<BestiaryPattern>
_____P
_WWWWDWWWWWWW
_W...E......W
PDE.........W
_W..........W
_W..........W
_W.........EDP
_W..........W
PDE.........W
_W..........W
_W.......E..W
_WWWWWWWWDWWW
_________P
</BestiaryPattern>

A more complex house

Created by kenwebb on June 14, 2010. Votes: 12 Vote for this subtree. Tags: xml

Yet another house.

<BestiaryPattern x="25" y="45">
_WWWWW
_W...W
PDE..W
_W...W
_W..WWWW
_W.....WW
_W......WWWWWWWW
_W........W....W
PDE.......W....W
_W............EDP
_W........W....W
_WWWWW..WWWWWWWW
___W......W
___W......W
___WWWWWWWW
</BestiaryPattern>

Cat traps

Created by kenwebb on June 14, 2010. Votes: 12 Vote for this subtree. Tags: xml

This pattern is a specialized cat trap. Once a cat enters the outer door, you can keep closing doors until you've herded it into the inner room. Then you can reopen all but the inner door, and wait to lure in another cat.

<BestiaryPattern>
_WWWWW______WWWWWW
_W...WWWWWWWW....W
PDE..DDDDDDDD....W
_W...WWWWWWWW....W
_WWWWW______WWWWWW
</BestiaryPattern>

A better cat trap

Created by kenwebb on June 14, 2010. Votes: 12 Vote for this subtree. Tags: xml

This is a better cat trap, because the cat doesn't waste time in an outer room, but immediately starts down the hallway toward the inner cell.

<BestiaryPattern>
____________WWWWWW
_WWWWWWWWWWWW....W
PDDDDDDDDDDDD....W
_WWWWWWWWWWWW....W
____________WWWWWW
</BestiaryPattern>

New types of beasts

Created by kenwebb on June 14, 2010. Votes: 12 Vote for this subtree. Tags: java

It's easy to create a new type of beast. To create a dog and paste it into the grid, select the following XML and Java text. Paste it anywhere on the grid, or paste (or drag and drop) it into the Beasts node in the Xholon GUI (the tree). It should appear in the grid, but it won't do anything yet because it doesn't have any behaviors.

<Dog implName="lang:beanshell:inline:"><![CDATA[
import org.primordion.user.app.Bestiary.Beast;
public class Dog extends Beast {}
new Dog();
]]></Dog>

Dog movement behavior

Created by kenwebb on June 14, 2010. Votes: 12 Vote for this subtree. Tags: java

To get your dog moving, paste the following as a last child of the dog. It's a bit tricky getting ahold of the dog so you can add the new behavior. But it's easier than dragging your dog off to obediance school.
Locate the dog in the grid (it should have a distinctive color), Open a console window on that location by double-clicking where the dog is in the grid, Type this command into the console window:

xpath *
and press the Submit button, Select Edit --> Clear Command from the console menu, Select and copy the following MovingDogbehavior text, Paste the text into the console window (or just drag and drop it from this web page to the console), Press the Submit button. Your dog should start moving.

<MovingDogbehavior implName="lang:beanshell:inline:"><![CDATA[
import org.primordion.xholon.base.IXholon;
import org.primordion.user.app.Bestiary.MovingBeastBehavior;
public class MovingDogbehavior extends MovingBeastBehavior {
  public void postConfigure() {
    setBeast(getParentNode());
  }
  protected boolean canMoveThruDoor(IXholon door) {
    return false;
  }
}
new MovingDogbehavior();
]]></MovingDogbehavior>

"Scare a cat to death" dog behavior

Created by kenwebb on June 14, 2010. Votes: 12 Vote for this subtree. Tags: java

My cat Licorice will hate this section if he reads it, so shhhh. Alternatively, you can think of it as the dog chasing a cat up a tree. It's just that there aren't any trees yet in the simulation, and cats don't yet have a tree climbing behavior. So, what might happen when cats and dogs run into each other outdoors? Try this.

<ScareCatToDeathDogbehavior implName="lang:beanshell:inline:"><![CDATA[
import org.primordion.xholon.base.IXholon;
import org.primordion.user.app.Bestiary.BeastBehavior;
public class ScareCatToDeathDogbehavior extends BeastBehavior {
  public void postConfigure() {
    setBeast(getParentNode());
  }
  public void act() {
    scareCatToDeath();
    super.act();
  }
  protected void scareCatToDeath() {
    IXholon node = getBeast().getFirstSibling();
    while (node != null) {
      if ((node != this) && ("Cat".equals(node.getXhcName()))) {
        // scare the cat to death; make it "cat"atonic by removing movement and other behaviors
        removeCatBehaviors(node);
        return;
      }
      node = node.getNextSibling();
    }
  }
  protected void removeCatBehaviors(IXholon cat) {
    IXholon b = cat.getFirstChild();
    while (b != null) {
      IXholon temp = b;
      b = b.getNextSibling();
      temp.removeChild();
    }
  }
}
new ScareCatToDeathDogbehavior();
]]></ScareCatToDeathDogbehavior>

A new cat

Created by kenwebb on June 14, 2010. Votes: 12 Vote for this subtree. Tags: xml

You can paste in a new cat complete with cat behaviors. Drag the following to the Beasts node, or copy and paste it directly to the grid.

<Cat>
  <MovingCatbehavior/>
  <GrowingCatbehavior/>
  <FreedomOfMovementCatbehavior/>
</Cat>

A litter of new cats

Created by kenwebb on June 14, 2010. Votes: 12 Vote for this subtree. Tags: xml

You can paste in multiple cats at a time (in this case 10 cats), as an XML forest.

<_-.beasts>
  <Cat multiplicity="10">
    <MovingCatbehavior/>
    <GrowingCatbehavior/>
    <FreedomOfMovementCatbehavior/>
  </Cat>
</_-.beasts>

First-aid for catatonic cats

Created by licorice on June 14, 2010. Votes: 12 Vote for this subtree. Tags: xml

If you find a cat that's been scared by a dog, and seems catatonic (it can't move), you can restore it by injecting it with a full-spectrum behavior transplant.

<_-.firstaid>
  <MovingCatbehavior/>
  <GrowingCatbehavior/>
  <FreedomOfMovementCatbehavior/>
</_-.firstaid>

Embedding structures in .png files

Created by kenwebb on June 14, 2010. Votes: 12 Vote for this subtree. Tags: png

The following .png images are how the above houses and cat traps look once they've been pasted into the grid. You can actually paste these .png images directly into the grid. Just follow these steps:

Other things you can do with the Bestiary app

Created by kenwebb on June 14, 2010. Votes: 12 Vote for this subtree. Tags:

Other things you can do with the Bestiary app include: