Replies: 1 comment
-
I currently prefer key value over facts but im prob biased as gauge provides builtin key value stores. /**
*
* @param name the name of memory the {@link Actor} {@link #memorizes}s
* @param question the {@Question} the {@link Actor} {@link #memorizes}s
* @return this {@link Actor}
*/
public Actor memorizes(String name, Question question) {
memories.put(name, asksFor(question));
return this;
}
/**
* @param name the name of the memory the {@link Actor} {@link #recites}s
* @return the memory for the {@link Actor}'s {@link #memories}
* @throws MissingMemoryException if there's no memory {@link Class} in the
* {@link Actor}'s {@link #memories}
*/
public <T> T recites(String name) {
T memory = (T) memories.get(name);
if (memory == null) {
throw new MissingMemoryException(this, name);
}
return memory;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When answering a
Question
, theActor
could remember the answer automatically.To be considered:
Answers can be any type (incl.
String
,Integer
etc.).The current implementation of the
Actor
's memory allows only one instance of a type. Unintended overwrites of memories could happen easily.Both would be mitigated if the Answer needs to be a
Fact
to be remembered.The alternative would be changing the
Actor
's memory in which memories can be any type but need to be named (key/value store).Beta Was this translation helpful? Give feedback.
All reactions