bootstrap confirm dialog and transient alert April 26, 2013
Posted by ficial in javascript, techy, webdev.Tags: bootstrap, code, confirm dialog, CSS, HTML, javascript, transient alert, web dev, webdev
add a comment
I’ve recently been doing some work on a web app that will use / is using the twitter bootstrap framework. There were two pieces of functionality that I wanted that weren’t readily available: transient alerts and confirmation dialogs. A transient alert is a message that appears and then fades away in a short period of time. A confirmation dialog is a modal dialog where some action happens when the user clicks a ‘Yes’ button, and nothing happens when they cancel/close/click ‘No’.
The confirm dialog was a fairly straight-forward adaption of the built in Modal element in bootstrap. However, the basic one fell short in several ways:
- The appearance was way too complicated for what I wanted, and simultaneously didn’t stand out enough
- The keyboard interaction was a bit sub-par; I wanted users to be able to use Enter to confirm as well as Escape to cancel – bootstrap supports the latter but not the former
- It was difficult to do something useful with a confirmation – the bootstrap Modal element doesn’t actually block execution, so you can’t easily wait for a response in code; you have to bind the relevant action to the click event of the Yes button
To build my confirm dialog I:
- Tweaked the CSS to reduce the noise and complexity, and to make the element stand out more
- Constructed a simple, stripped down DOM structure that works with the basic bootstrap Modal system. I store this in the JS file next to the launcher function just to keep relevant things close to each other.
- Built a JS function that takes a message and an handler that’s called when the Yes button is clicked
- Used a global to simplify passing data into the handler function
Then to use the confirm dialog create an action handler and then specify a click event (or other event, I guess) handler that launches the confirm dialog with an appropriate message and the event handler. If needed, first store any relevant data in the global data passing variable.
Here’s the code for the confirmation dialog (definition and example usage).
The transient alert was simpler in some ways in that I decided to build it form the ground up – leaning on bootstrap for some styling, but not for functionality. Essentially, it’s a simple div with replaceable text. When the transient alert is activated the text is changed as appropriate and a fade-out transition is initiated.
Here’s the code for the transient alert (definition and example usage).
We Design Our House April 13, 2013
Posted by ficial in house building.Tags: design, home design, house building
add a comment
We’ve been living in our house for about 2 1/4 years now (same age as our son) and have been very happy with the way it turned out. The design process was long and intensive, but in the end seems to have worked. We pretty much made up our process as we went along, though it was a bit less haphazard than that sounds. We’re both fairly analytically inclined, and have read a number of design books on a wide range of realms (pottery, urban planning, architecture, landscaping, forestry, woodworking,…). From our background and reading and discussions we concluded that good design processes at their core do two essential things. First, they determine the intersection of values, goals/features, functionality, and complexity (where complexity encompasses cost, resources, and difficulty of implementation). Second, they provide a relative metric for prioritizing development – that is, for any two aspects of the project there is away of determining which one is more important. We created our design process based on those two points.
In brief summary, the process we used boils down to:
- Articulate – brainstorm; clearly list values (abstract ideals), features (specific elements, often measurable/concrete), and functions (things that need to be done supported)
- Analyze – determine how the above relate to each other; use numbers; trim and/or add items as needed
- Arrange – group functions, then relate the function groups to each other; use that as the basis for layouts
- Adjust – starting with the basis as representing rooms/areas, push, pull, split, and join based on the values and features
- Appraise – determine whether a given design is ultimately acceptable; re-consider the numbers assigned to values and features; if a design does not work, either adjust it further or start again with the layout basis
- Accept – decide that a given design is good enough; make sure it’s actually doable (i.e. check that it won’t fall down and can be built within budget)
(okay, so I’m a sucker for alliteration)
In rather more detail….
Our first step was to create a list of the values we cared about. These are the intangibles, subjectives, and other fuzzy goals. We did this with an initial brainstorming session of about an hour plus additional ideas and refinements over the next week (though in a sense we did it in various conversations and day dreams over 5+ years, or in our heads over our lifetimes). A value would be a single word or short phrase, with 1-3 sentences detailing/expanding the idea. After a week we revisited our ideas and trimmed and combined to create set of 15 values:
- Beauty: It’s important that things be pretty; aesthetics counts, not for everything, but for something.
- Being Outside: We like being outside, for reasons both physical and spiritual/mental.
- Choice/Freedom: Within limits, do what we want. Not unduly tied down/constrained by our home/yard.
- Comfort: Most physical comfort. Good food, comfy temperature, no bugs, etc.
- Community: Family, friends, neighbors, fellow residents of the town, county, state, nation, world, watershed, and bioregions.
- DIY: We derive joy and satisfaction from doing things ourselves, even when it’s not necessarily the most efficient/effictive approach.
- Eco-integration: The house and grounds and residents are a part of the local eco-system.
- Environmental Stewardship: Taking care of the local and larger environment, making it better/healthier, preserving it for the future
- Fun: Having fun is not being happy, but it IS a PART of being happy.
- Health: Mental and physical health: exercise, nutrition, safety, peace of mind, anti-stress
- Learning: We like both learnign and knowing stuff.
- Positive Legacy: For future generations and residents.
- Preparedness: Future-aware, mindful of what will and may come. Preparing for possible and unavoidable life changes.
- Privacy: Both from locals and from family/friends.
- Self Sufficiency: But not to the point of cutting off the rest of the world.
We waited a bit to let our heads clear, then did a similar sort of brainstorming session for goals/features. These are specific aspects / elements we would like to be present in the finished house. Our features list ran to 52 items:
- Annuals gardens
- We have sufficient and appropriate space for our hobbies
- We grow/raise/forage much of our own food
- Long term timber planting
- Fungiculture
- We perform horticultural/fungicultural experiments and research
- Design around solar more than other local energy sources
- Maple syrup (harvesting sap, boiling to syrup)
- Others’ waste is our resource
- Local materials used preferentially
- Wood lot large enough to provide all heating needs, with a buffer.
- Both private and public inviting areas
- We have a variety of decorative plants and hardscape
- Divisions of wild and civilized – clear what is ours
- Fun/silly (fantasy nature trail, art (eg giant chair)
- Our land has a style/flavor that we enjoy
- Streams are good
- Aesthetically and practically not car dominated
- Yard/land has large and small art
- Expose infrastructure, hide services
- Good views (peaceful, inspiring, alive)
- We like outbuildings
- We have comfortable outdoor space
- A place to be outside while it’s raining but remain dry
- market gardening an option
- Injury and old age friendly
- Consider garden/yard maintenance: total time (more than a little, but not too much), total fussing (some for a few plants), consider peak times and other fluctuating time demands, what kinds of garden work do we prefer?dislike?
- We can travel/go on vacations (a week or more, but less than a month)
- Possible rental potential
- Our land/home is adaptable and/or planned for changes in our life
- Debt free
- Non-wage income sources/options
- Kid friendly (fun, educational, safe, not poisonous)
- Variety of fruits and nuts for fresh eating and preserving
- Varmint control (micro, macro and mega)
- Comfortable year round (house and land/yard)
- We have leisure time.
- We want people to visit, but not for too long
- Guests (short and long term) like visiting us
- Potential for long term guests and relatives
- Compatible with the camp up the road
- Compatible with area population growth
- Minimize waste output
- Much diverse habitat
- We use water wisely
- Bats/bat habitat
- Bird houses (fowl & wild birds)
- Hedging bets on climate (drought, flood, fire, heat, cold)
- Durable – build for the long term (stable design, the essential parts will work indefinitely with reasonable maintenance)
- Diversity is very important, plant wise and other
- Minimal imported energy needs/use
- SCIENCE! Observe & record, plots, labels, sensors, place to do analysis
We then put our values and features in a big matrix in a spreadsheet – values as the column heading and features as the row headings. For each feature we read across and put a 1 in the column if that feature contributed significantly to that value. Sums across then indicate the breadth of support the feature has for our values and thus gives a rough metric for comparing importance of features, and sums down indicate a depth of support for a given value and thus gives a rough metric for comparing importance of values. After that we took another couple of weeks break to mull things over and tweak numbers and weightings a bit.
The last major brainstorming step was coming up with the set of functions. We kicked this off with an hour or so of jotting down ideas on note cards, and kept adding to the pile over the course of a week or so. These are very short descriptions of things that we wanted or needed to do. E.g. cook and bake at the same time and with multiple people working at once, store the trash between trips to the transfer station, support recycling, have a place for the cat litter, host a food-oriented gathering of 15+ people, store and present our library of 2000+ books, and so on. We came up with MANY functions, from necessary to frivilous. Then we spent a long eveing doing a big sort. The functions got put into 3 piles. The first pile was the essential functions and included things like sleeping space, cooking, etc. The second pile was things that we cared about a lot but weren’t REALLY a necessity for having a house (e.g. a place to start seeds in the spring, a place for guests to sleep, etc.). The third pile was things that would be nice to have but we wouldn’t be too disappointed if they didn’t make it. Technically there was also a fourth pile of things we decided we didn’t care about, but we just tossed those in the recycling. Some functions were easy to place, but many were part-way between two piles. To decide which pile to put the liminal functions in we referred to our value-feature matrix to see the relative importance of the various values and features to which that function related.
The next step, a couple of nights later, was to collect the functions into related groupings – e.g. ‘a place to get dressed’ and ‘a place to store clothes’ would go together. First we did the groupings for the essential functions. Then we tried to fit the desired functions into those groupings (and did some reorganizing as we went). Then we went through our nice-to-have functions into those groups, with minimal additional reorganizing. At the end of this we had our functional clusters, which began to give us a picture of what rooms / areas our house would have.
The next session we did a quick re-check of the groupings, did a little reorganizing, and created cluster cards. A cluster card had a title (e.g. ‘master bedroom’, ‘group C’, ‘laundry’, etc.) and a list of the functions – at this point we stopped working with the individual function cards. We then explored relationships among the clusters. E.g. the laundry is linked to the bedrooms (where the undressing functions reside) and the outdoors (where the air-drying function resides). Some links were based on the functions in the clusters, while others were informed by our features and values. We did this by laying out all the cluster cards and moving them around, using distance to indicate degree of linkage (farther apart meant less linked). We took snapshots and notes about our results, then put the cluster cards away for the night. We repeated the cluster relations exercise a few times before we settled on an arrangement that satisfied us. Once the clusters were arranged it was a straightforward step to drawing lines between nearest neighbors, which indicated how the rooms in our house would be arranged/connected, or at least what the arrangement priorities would be when placing the rooms.
The actual layout began with the cluster relations as rooms and the connections between them as doorways and halls. That starting layout was then pushed, pulled, and twisted as we applied constraints and principles of efficient space use, passive solar design, monetary resources, required services, and, for want of a better description/name, human experience design. The first three are fairly straightforward to understand and apply. For efficient space use we looked to minimize pure-transit space and to assess objectively the space actually needed for the functions assigned to each room/realm. This was a bit tricky on the technical side, but mostly just a physical puzzle. Passive solar design basically boils down to 1) good solar orientation, 2) lots of south-facing glazing (at least, for passive solar heating, which we needed) and correspondingly little north-facing glazing, 3) sun-accessible thermal mass to soak up the heat, and 4) good insulation and a tight shell. Monetary resources were simply savings + income + loans. Required services refers to things like making sure sewer, water, electricity, are available where needed, as well as things like a vent for the dryer, a chimney for the woodstove, etc.
Human experience design is bringing intention to the human experience of being in a space/structure. This is what gives a building its character / feeling. In our values and features we had a number of items pertaining to the experience factor – e.g. goth private and public inviting areas, good views – but little initial idea of how to accomplish/realize them. In our readings and research related to this we also came upon a several of other ideas / concepts / design principles which we adopted. Since this post is mostly about the process of design I won’t go into detail on this topic. However, if you’re interested in it, here are some of the books we found especially useful/relevant/inspiring:
- A Pattern Language: Towns, Buildings, Construction by Christoher Alexander (http://www.amazon.com/Pattern-Language-Buildings-Construction-Environmental/dp/0195019199)
- general concept of a pattern language
- some specific design patterns / elements
- Gaia’s Garden: A Guide To Home-Scale Permaculture by Toby Hemenway (http://www.amazon.com/Gaias-Garden-Second-Home-Scale-Permaculture/dp/1603580298)
- zones and sectors
- general permaculture principles
- The Not So Big House: A Blueprint for the Way We Really Live by Sarah Susanka (http://www.amazon.com/The-Not-Big-House-Blueprint/dp/1561583766), and other books in the series
- efficient and effective use of space
- focus on experience
- various books on garden design, especially Japanese gardens
- relationships between various spaces of various kinds
- how a person’s experience changes as they move through a space
- How Buildings Learn: What Happens After They’re Built by Stewart Brand (http://www.amazon.com/How-Buildings-Learn-Happens-Theyre/dp/0140139966/ref=pd_sim_b_16)
- building for re-use / the long term
- enduring style
- ways kinds of spaces are likely / able to be re-purposed/adapted
- Home Work: Handbuilt Shelter by Lloyd Kahn (http://www.amazon.com/Home-Work-Handbuilt-Lloyd-Kahn/dp/0936070331)
- general inspiration of neat buildings
- Alternative Housebuilding by Mike McClintock (http://www.amazon.com/Alternative-Housebuilding-Mike-McClintock/dp/0806969954)
- general inspiration of neat buildings
- introduction to various construction options
- Little House on a Small Planet: Simple Homes, Cozy Retreats, and Energy Efficient Possibilities by Shay Salomon (http://www.amazon.com/Little-House-Small-Planet-Possibilities/dp/B007K51WXW)
- efficient and effective use of space and resources
- Mortgage Free!, Second Edition: Innovative Strategies for Debt-Free Home Ownership by Rob Roy (http://www.amazon.com/Mortgage-Free-Second-Innovative-Strategies/dp/1603580654)
- ways to add sweat equity
- practicalities
- earth berming and earth roof
-
lots of pictures of houses and other structures
- general inspiration and examples
We also did an exercise where we listed all the houses and other structures that we’d been in and could clearly picture and discuss, and what about each of those houses felt good to us and in what way, and which elements of those houses contributed to those feelings and how/why. After a while, with the readings and the exercise, we felt we had some decent grasp of some ways to generate / evoke the experience we wanted to have in our home.
We came up with a number of theoretically viable designs before we settled on the one that lead to our current home. Each time we came up with something that looked workable we held it up to our values and goals and double-checked both that it sufficiently met them, and that we felt those goals and values still applied. Some major decisions that lead to new layouts:
- Small-to-medium house rather than tiny house – our hobbies require significant infrastructure, we have a good sized collection of books, and we wanted to have kid
- No earth roof – after seriously considering one design we decided that the technical challenges of building an earth roof for a hoped-to-be-200+-year-structure were just a little too much. There are certainly ways to do that, but we felt that those ways would too heavily impact other values and features.
- No earth berming – we weighed the technical and design challenges of berming and eventually decided that we could get much the same benefit through other means (mainly serious insulation amd serious thermal mass) and ditching the berming offered many benefits (e.g. exit-capable windows in every room, more light, less worry about water infiltration, simpler structural requirements)
- Willing to hire someone for some of the construction and to take on significant debt – this was a really tough choice / decision. Being willing to take on lots of debt meant that we could make a lot of capital-intensive investments which we expected to pay off in the long term (e.g. even more insulation, active solar home heating and DHW system, standing seam metal roof), and hiring a contractor meant a lot less stress. We were at a point where we could have quit our jobs and worked on the house full time, or hired someone else to deal with maor parts. After doing the calculations we determined that we’d actually save/make more money by continuing in our current jobs. In retrospect, our calculations have have been off… but we’re still happy with the house we have.
It was very, very useful and important to make quick 3D mock-ups of our designs in SketchUp (http://www.sketchup.com/), a free and easy-to-learn-and-use lightweight CAD program. Having a 3D model both let us get a much better sense of what it would be like in a given space, and highlighted structural issues that weren’t as readily apparent on paper – one initially-promising design was discarded because the 3D mock-up revealed that a major beam would have to cross the stairway at about 4 feet over the steps. We also ran designs by many friends and family to get critical feedback. Having lots of other people looking at designs and raising questions and/or making suggestions was vital – we certainly didn’t incorporate all others ideas, but some made it in after due consideration.
Eventually, we settled on a final design. Final-ish, anyway. At that point we brought in some professionals to do some sanity checks and maybe make additional suggestions. We talked first to a general contractor (whom we eventually hired) for general advice/ideas (a few of which we followed; in retrospect we should have ignored a couple of them (mainly ones related to design / human experience), but others were in fact quite useful (in the technical building realm) – lack of actual experience can be a real hamper in figuring out which professional advice can be safely ignored/discarded), and then to a timber framing company to ensure our house would actually stand up (we hired that company to procure and cut the beams, which our GC then assembled (with both of us working as assistants / peons on his crew)).
From brainstorming values to the truly final design of our home took probably about 18-24 months (my memory is hazy on the timing details). The first part (articulate, analyze, and arrange) took probably 2 months. most of the remaining time was all about looping through the adjust-appraise cycle. The final month or two dealt with incorporating feeback from the professionals (e.g. in our first final design we’d conservatively calculated 10 maximum foot spans, but the timber frame maker was able to extend that to 16, which changed the post locations and thus some of our wall locations).
Overall, it was a great experience in which we learned a lot (e.g. never start your home building project in New England in October), and now we live in the house of which we hadn’t before realized we’d always dreamed.
More morality system thoughts April 4, 2013
Posted by ficial in brain dump.Tags: belief system, software, technology
add a comment
I’ve been thinking a bit more about the kinds of choices that an agent can make: solipsistic, tolerant, and empathetic. The tolerant and empathetic ones are the more interesting ones (to me, anyway) because that’s where we begin to get into the idea of morality in the common definition – i.e. how what something does impacts other things, and how that affects the choices one makes. That’s also where the complexity of the system grows dramatically. Those two realms are different from the solipsistic one in that they require taking into account the preferences of other entities.
There are two main branches an agent can take when making a tolerance or empathy evaluation. The first is a projection based approach, where the agent makes the evaluation using its own belief system but from the perspective of the other entity (i.e. the context is identical except that the agent is in the position of the other entity and the agent role in that context is filled by an imaginary independent copy of the actual agent). The second is a model based approach. In this case the agent attempts to use the other entity’s own belief system to make the evaluation for that entity’s position. Since (at least in the real world) it’s basically impossible to use (or even have) a perfect model of the other entity’s belief system the agent must use a simplified model. Depending on the degree of simplification this could potentially make the modeled approach less complex (in terms of storage and processing requirements) than the projected one. Agents can certainly use a mix of the two approaches, and part of the evaluation function is about deciding which approach to use for any given entity.
One can consider projection to be a subset of modeling. Any given model will have variations from / limitation relative to the entity on which it is based. In a projection based approach the validity of the model is directly dependent on the homogeneity of the entity population – if the agent and all entities are quite similar, the projection will be a good model, but if the agent and entities are all different then it will be bad model.
Regardless of the approach, any evaluation function that itself takes into account other entities potentially becomes mired down in recursion (“I know that you know that I know that you know that I can’t drink from the cup nearest me…”). There are three main strategies to resolve this:
- explicitly limit the depth of recursion
- require strictly simpler models (i.e. the model used to do the evaluation in a function must be strictly simpler than the model which caused the function to be used/called), which gives an implicit base case (NOTE: but not necessarily a limited depth unless we also specify a minimum complexity delta)
- do something complicated with a differential-equation-like approach
I don’t really know where to go with all that other than to note that it’s a difficult problem.
Over all, an entity takes more account of other entities as it shifts along the solipsistic->empathetic axis, and as it shifts along the projection->model axis.
There’s a significant increase in the complexity of making a choice in the shift from solipsistic to tolerant in that additional entities have to be considered. There’s an additional increase in complexity in the shift towards empathy as more outcomes have to be considered for each other entity. Once the entity is in at least the tolerant range then the complexity also increase based on how other entities are accounted for, and the complexity path probably looks something like: simple model -> projection -> complex model.
There’s another level of complexity that hasn’t yet been covered, and that’s determining what counts as an entity. The more things in the world state that count as an entity the more complicated the processing becomes. That’s probably another function in an entity’s belief system:
DEF: “entity recognition”: a function that returns a number from 0 to 1 which indicates the ‘entity-ness’ of the trait-value in question – this is used in weighting the entity’s results when doing tolerance and empathy calculations
DEF: “strict entity recognition”,”loose entity recognition”: relative terms indicating the entity recognition function returns higher values for fewer or more (respectively) trait values.
———–
For an entity to have some kind of morality in the natural-language sense there are a number of characteristics that are required for their belief system, AND for the world
- the entity must have at least 1 belief (evaluative or imperative) – an entity cannot be moral if it has no way of placing a value on what it does and/or the state of the world
- there must exist a capability where the entity is the agent and the world state is morally relevant to that entity – an entity cannot be moral if there is no way for its beliefs to be impact the world
- the entity must have a non-zero tolerance – this point is arguable, but for now at least I’d say that an entity that does not account for anything other than itself is cannot be moral in the natural language sense
- the entity’s recognition function must identify at least one other entity in the world state which is in the capability for which the first entity is the agent – same as above, an entity cannot be moral without considering at least one other entity
Overall, the factors that limit an entity’s ability to be moral are:
- the tolerance (and empathy) of the belief system
- the fidelity of the model of the world (i.e. the world-state representation used in various functions); this may be subdivided into:
- selection: what is included in the model vs how the world actually is (NOTE: selection is subtly different from abstraction, though the boundary between the two is fuzzy; abstraction is ‘ignoring the parts that are irrelevant [to the current work/problem], selection is ‘choosing which parts to include regardless of relevance’; the blurriness arises from the designation of what exactly ‘irrelevant’ is)
- accuracy: how closely the things that are in the model match/represent reality; how good a predictor the model is of reality
- the ability to recognize other entities (i.e. the looseness/strictness of entity recognition)
- the fidelity of models of the belief system of other entities (potentially including accounting for the fidelity of their world-state models as well)
- the level of complexity / amount of work the processing system can handle
- the power/opportunity to take actions / make choices
Each of these factors may be rated low to high. An entity’s ability to be moral is limited by the lowest rating of the above factors.
The fidelity of the world model is in turn limited by the ability of the entity to perceive the world. Similarly, the fidelity of models of beliefs of other entities is limited by the ability to perceive the beliefs of other entities – this comes down to observation and communication.
———–
DEF: ‘moral conflict’: Two (or more) entities have a moral conflict if they would choose different actions given capabilities that are the same except for the agent. .The degree of conflict is the sum of the differences between the ratings the two entities gave for each action; e.g. entity A and B choose actions a and b respectively, the degree of conflict is (Aa-Ba) + (Bb-Ab).
Moral conflict may arise from the core beliefs of the entities (i.e. what is the right and wrong kind of action to take, and what makes a world state better or worse). However, even with identical imperatives and evaluatives, conflicts can arise due to variations in the above limiting factors. E.g. given two entities that believe equally that it is important to give money to other entities, the choice of what to do with a pile of money depends then on what else in the world is recognized as an entity.
———–
I think my next exploration of this topic will be to try putting together some actual morality structures – outlining a data structure for a morality system and trying to use that to model one or a couple of kinds of entities.
A Math of Morality and Belief March 4, 2013
Posted by ficial in brain dump.Tags: AI, math, memetic engineering, morality, parenting, set theory
add a comment
Our kid is now a bit over 2 years old, which means he’s well into the sociopathic midget stage of growing up, and I’ve just been reading a future-of-humanity novel (Accelerando, by Charles Stross – I give it 3.5 out of 5; it’s flawed, but has some interesting ideas anyway. For a better version of more-or-less the same kind of thing I’d recommend Schismatrix by Bruce Sterling instead). So, that’s gotten thinking about building/creating/evolving and describing morality systems. We can’t expect anything – a child, a corporation, a program – to behave morally unless that thing has a way to represent what it means to be moral. For people we pretty much just wing it and they pretty much learn it (where ‘it’ is ‘some way to evaluate actions and the world’ rather than any particular moral/belief structure) as they grow up. For other things… well, we shouldn’t expect a strong AI to be moral if it’s source doesn’t contain a way for it to have and evolve a moral system. So, between all that and the mild fever from the tail end of a cold, I give you my first stab at:
A Math of Morality and Belief
Part 1: Establishing a formal framework / terminology for discussion and analysis of morality and belief structures. This framework should handle everything from people to business to software to trees.
DEF: “trait”: an arbitrary element (a scalar)
DEF: “value”: an arbitrary element (a scalar, or possibly a complex structure)
DEF: “trait-value”: a set {t,v} where t is a trait and v is a value
DEF: “world state”: a set of trait values where no trait is in more than one trait-value.
NOTE: a trait t1 in a world state c may be referred to as c.t1. The value v1 of a trait-value {t1,v1} in the world state c may be referred to as c.t1.v1
NOTE: a world states are of necessity limited approximations / representations of the whole, real universe.
DEF: “dense world state”: a world state that has relatively many traits and attempts a relatively accurate representation of the real universe
DEF: “sparse world state”: a world state that has relatively few traits and represents a relatively limited and/or abstract representation of the real universe
DEF: “an action”: an action is a function on a world state that results in another world state
DEF: “valid action”: an action is valid for a world state c when
* action(c) = cprime
* there exists at least one trait tx such that cprime.tx.value != c.tx.value
NOTE: under this formal definition of “action” the human language concept of “take no action” would be an action if it resulted in a changed world state.
DEF: “action value”: a set containing an action and a number from 0 to 1
DEF: “action space”: a set action values, where no action appears in more than 1 value
DEF: “imperative”: a function that takes an any action and returns a number from 0 to 1, or a null (which means “this imperative does not apply”)
DEF: “evaluative”: a function that takes any world state and returns a number from 0 to 1, or a null (which means “this evaluative does not apply”)
DEF: “a belief”: shorthand for “an imperative or an evaluative”
DEF: “situational relevance”: a function that takes a world state and a belief and returns a number from 0 to 1
NOTE: these kind of functions need to be able to handle ANY world state or action, and thus must be implemented as a finite system with a default handler for anything the system doesn’t know how to evaluate (typically, the default is ‘null’, though it could also be a number generated with some kind of parameterized randomizer). The system which these functions use can process individual traits and values, and can also handle the world state as a whole (e.g. look at the count of trait-values).
NOTE: the situational relevant function may NOT return a null – it’s implementation must always return a number between 0 and 1.
DEF: “means-ends balance”: a function that takes two numbers each from 0 to 1, the first number representing a valuation of a means and the second of an end, and returns a number from 0 to 1
DEF: “bounds”: a function that takes a number from 0 to 1 and returns true or false
DEF: “out of bounds”: a number for which the bounds function returns false
DEF: “belief system”: a set containing 0 or more beliefs, a situational relevance, a means-end balance, and a bounds
NOTE: belief systems may be complex, but they can also be very basic – e.g. a tree could have a very simple ‘belief system’ that contains no imperative, a few very straightforward evaluatives, and blind functions for situational relevance, means-end balance, and bounds.
DEF: “viable context (of a belief system)”: the set of all world states and actions for which at least one belief in the system returns a number (i.e. not null).
DEF: “entity”: a set of trait-values and a belief system
NOTE: entities may be values of a world state
DEF: “possibility”: a world state and a set of 1 or more actions that are valid for that world state
DEF: “capability”: an entity and a possibility; the entity is one of the values of the world state of the possibility
DEF: “agent entity”: the entity in a capability
DEF: “non-agent entity”: an entity in a world state of a possibility for which there does not exist a capability containing that entity and that world state
DEF: “judgement”: a function that takes a capability (or an entity and a possibility) and an action in that capability(or possibility) and returns a number from 0 to 1, or null (meaning the action is irrelevant to the agent or entity) that is generated by running the agent’s (or entity’s) world state-weighted (via situational relevance) beliefs against the action and the hypothetical result-world state of that action.
DEF: “action judgements”: the action space that is generated by judging each action in a capability
DEF: “allowable actions”: the action space that is generated by judging each action in a capability and excluding any for which the result is out of bounds
DEF: “acceptable action”: a function that takes an entity, a possibility, and an action in that possibility and returns a true or false. The response is true if the action is in the allowable actions set for that entity and possibility, or if the judgement of the action is null. The response is otherwise false.
DEF: “morally relevant to an entity”: a world state is morally relevant if there exists a capability that contains that entity and that world state, and at least one action in the capability is not in the allowable actions of that capability
DEF:”morality space of an entity”: the set of all world states that are morally relevant to an entity
DEF:”morality space of a belief system”: the set of all world states that are morally relevant to an entity that holds the belief system
DEF: “impacted entity”: an an entity in a world state in a possibility for which the action judgements contain at least one non-null value.
DEF: “solipsistically optimal action”: the highest rated action in allowable actions
DEF: “tolerance”: tolerance is one of the traits for an entity (or possibly an addition to a belief system – the distinction gets a bit blurry; perhaps the elements of a belief set are flattened into attributes of an entity). Its value is a number from 0 to 1. Tolerance becomes relevant when the world state of an agent’s capability includes 1 or more other entities. It measures how far below the solipsistically optimal action value the agent is willing to go to select an action that is acceptable to the other entities.
NOTE: the method/function which an agent uses to composite ratings of other entities could also be a trait value of the entity or another element of a belief system.
DEF: “tolerable actions”: all actions with a rating within tolerance of the solipsistically optimal action
DEF: “tolerantly optimal action”: the highest rated action with a rating within tolerance of the solipsistically optimal action for which that action is acceptable to the other entities in the world state (or a maximal subset of them).
DEF: “empathy “: empathy is another trait for an entity. Its value is a number from 0 to 1. It indicates how far below the tolerantly optimal action the agent is willing to go in order to maximize the composite of the judgements of the other entities.
DEF: “empathetically optimal action”: the action within the empathy range of the tolerantly optimal action for which the composite of ratings of other entities for that action is highest.
Part 2: Exploration of entities and morality. Currently unwritten. I may get to it someday, or I may not. I would enjoy discussing this topic with anyone interested.
Web Games and Images for them February 5, 2013
Posted by ficial in computer games, games, IP issues, javascript, techy.add a comment
Recently I participated in the Innovate Game Jam (I did the Pro16 format) organized by Morgan McGuire. It was much fun to work with such a short time frame – it gave me freedom to just Make It Work rather than worrying too much about broader architecture and maintenance issues (which I do a LOT of in my regular job). Plus, I got a working game out of it – Explosion Golf! I enjoyed the game enough that I’ve continued work on it after the jam. I am continually impressed with what can be done with javascript these days.
One of the issues I ran into with the game was finding freely available art assets. I was able to get a few things from SpriteLib and OpenGameArt.org, and a few more by starting with CC licensed photos on flickr and modifying the heck out of them, but one of the items I had an especially difficult time getting was a simple, top-down walking animation sprite. I did find one that I was comfortable using during development, but I got no response from the creator when I contacted them about official licensing / permission. So, I recently buckled down and hacked together my own 8-frame, top-down walking image series
which I’m releasing under the Creative Commons license (attribution required, derivs OK, commercial use OK) in case anyone else out there has run into a similar difficulty. It’s far from perfect, but it’s good enough to get the job done if you’re working under extreme budget and time-frame limitations.







