Date: Mon, 08 Nov 2004 02:59:05 GMT
Message-ID: <ZhBjd.4230$EE3.2171_at_trndny09>
"Neo" <neo55592_at_hotmail.com> wrote in message
news:4b45d3ad.0411071807.4cbd51f0_at_posting.google.com...
> www.xdb2.com/Example/Ex112.asp demos how to represent things needed to
> calculate the cost of traveling between any two towns via multiple
> paths. The example allows the path between any two towns to be uni or
> bi-directional. The example allows the specification of travel cost
> during any time period of each weekday.
>
> More specifically, the example represents the following things: Four
> towns named a, b, c, d (imagine them forming a square). There are
> paths from a to b, b to c, c to d and d to a. There are also opposite
> paths from a to d, d to c, c to b and b to a. In addition, there are
> two uni-directional cross paths, one from a to c and the second from b
> to d. The cost of travel from town a to town b on Monday between 00:00
> and 24:00 is 1.00.
>
> The script below stores above things:
>
> // Create towns a, b, c, d
> CREATE2 *town.cls = thing;
> CREATE2 *a.cls = town;
> CREATE2 *b.cls = town;
> CREATE2 *c.cls = town;
> CREATE2 *d.cls = town;
>
> // Create directional verb "to"
> // which leads to lower level (aka creature)
> CREATE2 *goto.cls = verb;
> CREATE2 goto.vbType = cr;
>
> // Create a square shaped graph
> // Note: outer paths are bi-dir
> CREATE2 a.goto = b;
> CREATE2 b.goto = a;
>
> CREATE2 b.goto = c;
> CREATE2 c.goto = b;
>
> CREATE2 c.goto = d;
> CREATE2 d.to = c;
>
> CREATE2 d.goto = a;
> CREATE2 a.goto = d;
>
> // Note: inner cross paths are uni-dir
> CREATE2 a.goto = c;
> CREATE2 b.goto = d;
>
> // Create weekdays
> CREATE2 *weekday.cls = thing;
>
> // Create start time of day (inclusive)
> CREATE2 *start.cls = thing;
>
> // Create end time of day (exclusive)
> CREATE2 *end.cls = thing;
>
> // Create costs
> CREATE2 *cost.cls = thing;
>
> // Create it cost 1.00 to go from town a to town b
> // on monday between 00:00 and 24:00
> CREATE2 (a.goto=b).weekday = +monday;
> CREATE2 ((a.goto=b).weekday=monday).start = +00:00;
> CREATE2 (((a.goto=b).weekday=monday).start=00:00).end = +24:00;
> CREATE2 ((((a.goto=b).weekday=monday).start=00:00).end=24:00).cost =
> +1.00;
Let us analyze:
* Neo has stored the word "monday" 4 times.
* Neo has stored letters a, b, c, d more times than I care to count.
Therefore, Neo is practicing redundancy.
- Neo has stored program code as data. Neo is practicing Object Orientation.
- What happens when trip goes to 64 towns in three months, visiting some towns more than once? Answer: Neo has stored big headache and carpal tunnel syndrome.
Here is some SQL for Neo to learn:
INSERT INTO neo VALUES 'common sense', 'integrity', 'honesty';