## Generated by Codox

# The-great-game 0.1.2-SNAPSHOT

# cc.journeyman.the-great-game.gossip.news-items

Using news items (propositions) to transfer knowledge between gossip agents.

## Status

What is here is essentially working. It’s not, however, working with the rich data objects which will be needed, and it’s not yet nearly efficient enough, but it allows knowledge to propagate through the world procedurally, at a rate limited by the speed of movement of the gossip agents.

## Discussion

The ideas here are based on the essay The spread of knowledge in a large game world, q.v.; they’ve advanced a little beyond that and will doubtless advance further in the course of writing and debugging this namespace.

A news item is a map with the keys:

- `date` - the date on which the reported event is claimed to have happened;
- `nth-hand` - the number of agents the news item has passed through;
- `verb` - what it is that happened (key into `news-topics`);

plus other keys taken from the `keys` value associated with the verb in `news-topics`.

## Notes:

TODO
This namespace at present considers the `:knowledge` of a gossip to be a flat list of propositions, each of which must be checked every time any new proposition is offered. This is woefully inefficient.

### all-known-verbs

All verbs currently known to the gossip system.

view source

### compatible-item?

`(compatible-item? new-item known-item)`

True if `new-item` is identical with, or less specific than, `known-item`.

If we already know ‘Bad Joe killed Sweet Daisy’, there’s no point in learning that ‘someone killed Sweet Daisy’, but there is point in learning ‘someone killed Sweet Daisy with poison’.

view source

### compatible-value?

`(compatible-value? new-value known-value)`

True if `known-value` is the same as `new-value`, or, for each key present in `new-value`, has the same value for that key.

The rationale here is that if `new-value` contains new or different information, it’s worth learning; otherwise, not.

view source

### degrade-character

`(degrade-character gossip character)`

Return a character specification like this `character`, but comprising only those properties this `gossip` is interested in.

view source

### degrade-location

`(degrade-location gossip location)`

Return a location specification like this `location`, but comprising only those elements this `gossip` is interested in. If none, return `nil`.

view source

### degrade-news-item

`(degrade-news-item gossip item)`

TODO: write docs

view source

### infer

`(infer item rule)`

Infer a new knowledge item from this `item`, following this `rule`.

view source

### interest-in-character

`(interest-in-character gossip character)`

Integer representation of how interesting this `character` is to this `gossip`. TODO: this assumes that characters are passed as keywords, but, as documented above, they probably have to be maps, to allow for degradation.

view source

### interest-in-location

`(interest-in-location gossip location)`

Integer representation of how interesting this `location` is to this `gossip`.

view source

### interesting-character?

`(interesting-character? gossip character)`

Boolean representation of whether this `character` is interesting to this `gossip`.

view source

### interesting-item?

`(interesting-item? gossip item)`

True if anything about this news `item` is interesting to this `gossip`.

view source

### interesting-location?

`(interesting-location? gossip location)`

True if the location of this news `item` is interesting to this `gossip`.

view source

### interesting-object?

`(interesting-object? gossip object)`

TODO: write docs

view source

### interesting-topic?

`(interesting-topic? gossip topic)`

TODO: write docs

view source

### interesting-verb?

`(interesting-verb? gossip verb)`

Is this `verb` interesting to this `gossip`?

view source

### known-item?

`(known-item? gossip item)`

True if this news `item` is already known to this `gossip`.

This means that the `gossip` already knows an item which identifiably has the same or more specific values for all the keys of this `item` except `:nth-hand`, `:confidence` and `:learned-from`.

view source

### learn-news-item

`(learn-news-item gossip item)``(learn-news-item gossip item follow-inferences?)`

Return a gossip like this `gossip`, which has learned this news `item` if it is of interest to them.

view source

### make-all-inferences

`(make-all-inferences item)`

Return a set of knowledge entries that can be inferred from this news `item`.

view source

### news-topics

Topics of interest to gossip agents. Topics are keyed in this map by their `verbs`. The `keys` associated with each topic are the extra pieces of information required to give context to a gossip item. Generally:

- `actor` is the id of the character who it is reported performed the action;
- `other` is the id of the character on whom it is reported the action was performed;
- `location` is the place at which the action was performed;
- `object` is an object (or possibly list of objects?) relevant to the action;
- `price` is special to buy/sell, but of significant interest to merchants.

## Characters

TODO but note that at most all the receiver can learn about a character from a news item is what the giver knows about that character, degraded by what the receiver finds interesting about them. If we just pass the id here, then either the receiver knows everything in the database about the character, or else the receiver knows nothing at all about the character. Neither is desirable. Further thought needed.

By implication, the character values passed should include all the information the giver knows about the character; that can then be degraded as the receiver stores only that segment which the receiver finds interesting.

## Locations

A ‘location’ value is a list comprising at most the x/y coordinate location and the ids of the settlement and region (possibly hierarchically) that contain the location. If the x/y is not local to the home of the receiving agent, they won’t remember it and won’t pass it on; if any of the ids are not interesting So location information will degrade progressively as the item is passed along.

It is assumed that the `:home` of a character is a location in this sense.

## Inferences

If an agent learns that Adam has married Betty, they can infer that Betty has married Adam; if they learn that Charles killed Dorothy, that Dorothy has died. I’m not convinced that my representation of inferences here is ideal.

view source