| … | … | @@ -430,27 +430,22 @@ |
| 430 | 430 | ; |
| 431 | 431 | ; The initialization is done with a graph-query and graph-rewrite |
| 432 | 432 | ; run over the AtomSpace. The query is simple: find all individuals |
| 433 | | ; attached with a `MemberLink` to an anchor node. The rewrite is |
| 434 | | ; trickier: its a `DeleteLink` whose contents are executed first. |
| 435 | | ; The contents perform the intialization of each individual that is |
| 436 | | ; found. The DeleteLink then just discards the wrapper ListLink. |
| 437 | | ; We didn't actually need to discard it, but it seems nice to not |
| 438 | | ; leave ponitless garbage lying round in the AtomSpace. |
| 433 | ; attached with a `MemberLink` to an anchor node. The rewrite |
| 434 | ; consists of the 3rd and subsequent clauses: all of the SetValues. |
| 439 | 435 | |
| 440 | 436 | (define (initialize-state) |
| 441 | 437 | (exec-unwrap |
| 442 | 438 | (Bind |
| 443 | 439 | (TypedVariable (Variable "$person") (Type "ConceptNode")) |
| 444 | 440 | (Present (Member (Variable "$person") anchor)) |
| 445 | | (Delete (List |
| 446 | | (SetValue (Variable "$person") seir-state susceptible) |
| 447 | | (SetValue (Variable "$person") susceptibility |
| 448 | | (RandomNumber (Number 0.2) (Number 0.8))) |
| 449 | | (SetValue (Variable "$person") infirmity |
| 450 | | (RandomNumber (Number 0.01) (Number 0.55))) |
| 451 | | (SetValue (Variable "$person") recovery |
| 452 | | (RandomNumber (Number 0.6) (Number 0.95))) |
| 453 | | )))) |
| 441 | (SetValue (Variable "$person") seir-state susceptible) |
| 442 | (SetValue (Variable "$person") susceptibility |
| 443 | (RandomNumber (Number 0.2) (Number 0.8))) |
| 444 | (SetValue (Variable "$person") infirmity |
| 445 | (RandomNumber (Number 0.01) (Number 0.55))) |
| 446 | (SetValue (Variable "$person") recovery |
| 447 | (RandomNumber (Number 0.6) (Number 0.95))) |
| 448 | )) |
| 454 | 449 | *unspecified*) |
| 455 | 450 | |
| 456 | 451 | ; Run the above. |