I'm reading this article by John Funge about Cognitive Modeling for Computer Games: http://www.qrg.northwestern.edu/resources/aigames.org/1999/fungegame99.pdf
And some further detailed reading about it in this URL:

I'm having a hard time to understand the CML: I understand it's some kind of mix between Imperative and Declarative programming, I just didn't understand how:

For example the following pseudo-code in Imperative Programming:

Declare a new List called ExpensiveItemsNames;
Foreach Item in Items:
If ItemPrice > 100 then
Add ItemName to ExpensiveItemsNames

vs the Declerative version: (using SQL)

SELECT ItemName FROM Items
WHERE ItemPrice > 100

What would be the CML version of it?
And how does CML help the programmer? I didn't understand that too.

As well, in the further detailed (as mentioned before - meaning the second link I put) website they also talk about pruning to reduce the space complexity.
While I know what is pruning, I couldn't understand it's relation to CML. They look like two unrelated things to me at the moment.
And also regarding pruning - in the original article it is not mentioned, but in "further detailed" website it mentions later a preprocessing stage - I didn't understand if it's related to the CML or not.

Ok, I understand that my initial saying that CML "it's some kind of mix between Imperative and Declarative programming" isn't true (though it is written in the article: "...but the distinguishing features of CML are the intuitive way domain knowledge can be specified and how it affords a game developer familiar control structures to focus the power of the reasoning engine. This forms an important middle ground between regular logic programming (as represented by Prolog) and traditional imperative programming (as typified by C)"

As far as I understand CML should answer these problems:
1. "if we are not extra careful about how we represent a character’s knowledge we can deprive them of “common sense” as they reason about the effects of their actions. What is the meanin of "extra careful" and how does it affect the "common sense" of the character? And how does CML help?

2 . "how to provide a convenient mechanism to allow the programmer to strike a balance between lots of fast pre-programmed behavior and more expensive run-time decision making".
I have my assumptions to this, but i'm not convinced they are true:
If we use only pre-programmed character, then the complexity can be also very hard to program and also very complex in terms of memory and the pre-processing running time.
However if we use only run-time decision making, then the character will be very "stupid" or it will have to start calculating a lot each step.
CML provides something in between, in the form of "reasoning engine", which fills details during run-time.
I didn't understand though how CML does this.
The article mentions it does calculations every once in a while: "In this way a character can anticipate that after a certain time period, or event, it will be ignorant of some aspect of its world, and it can plan to sense and re-plan. But i'm not sure I understood correctly.
The "further detailed" link mentions pruning, though the article doesn't. Perhaps this is a necessary part of CML?
3. "by using interval arithmetic to integrate sensing into our underlying theoretical framework, we enable characters to generate plans of action even when they find themselves in highly complex, dynamic virtual worlds.
I think the meaning of "interval" here is the space of what the character knows, and not the time intervals mentioned earlier. Is this also a necessary part of CML?

So those are a few more questions I would be happy to understand better if someone knows.


2 Answers 2


(Disclaimer: I know nothing about CML, artificial intelligence, simulations software, autonomous software agents, or whatever topic that is discussed here in this question. My answer is just based on my limited knowledge and the links you provided.)

Short answer: the terms you mentioned belong to different categories or abstraction levels, so it is hard to make comparison, analogies, or examples.

As @Brendan says, Imperative and Declarative are programming (coding) paradigms.

Based on the links you provided, Cognitive Modeling Programming appears to be most similar to either Logic Programming or Event-driven Programming, used within the context of software simulations of autonomous agents.

Inside a software simulation of autonomous agents, there is:

  • A world, along with all of its physical, deterministic mechanics
  • One or more agents, each of which separately:
    • Receives stimuli (senses, input) from the world
    • Does its own logic
    • Use the output of its own logic to control its own actuators (motors)
  • In some types of simulations, direct communication between two agents is allowed. This adds an extra mode of input (receiving message) and output (sending message) to each agent.
  • After completing a single time step, when all decisions have been made and all physical effects have been applied, the simulation software advances the time step and re-runs the decision-making and physical-effects all over again.
    • Agents are allowed to carry their memory forward, to reuse them in future time steps.
  • In some more realistic and advanced simulations,
    • Agents can have reasoning behavior. This requires each agent to make use of a inductive engine.
    • Agents can use statistical, pattern recognition, or machine learning systems to make decisions and to improve the model over time.

The reason I say "software simulation of agents" belongs to "a type of software application" as opposed to a paradigm is because nothing is said about how the agents does its own logic. In fact, many different programming paradigms have been put into use in implementing the logic of these agents. I have already mentioned a few possibilities above; there are many more paradigms being used in practice.

The Cognitive Modeling Programming in the links you provided appears to be one implementation of a domain-specific language, as @Brendan says.

Does it qualify as a programming language?

If you have obtained:

  1. A syntax and grammar for this programming language,
  2. A software implementation which you can run on a computer to verify what you have read about this programming language,

Then yes, it is a programming language for your purpose. Otherwise, it is merely a programming language you have read about, but have not yet verified for yourself.

I will say this as a pragmatist. Practically speaking, you should not treat it as if it is a real language, unless you are an academia, in which you trust the author(s) and the editor(s) under which it is published, or you are a student, in which you engage in a game of pretend-play with your instructor during the course of study.


Imperative Programming, Declarative Programming, Functional Programming and Object Oriented Programming are all "programming paradigms" - different ways of writing a solution to a problem.

Cognitive Modelling is a solution to a problem (specifically, a very old solution to the problem of modelling "intelligence"), and not a way of writing a solution to a problem and not a programming paradigm.

You could implement Cognitive Modelling with imperative programming (e.g. have a "plan(entity)" function), or implement Cognitive Modelling with OOP (e.g. have a "merman::plan()" method), or implement it with functional programming (e.g. have a "newstate = plan(oldState)" function).

You could also invent a special (domain specific) language for Cognitive Modelling; and in that case your special language could use any programming paradigm you like.

  • 1
    Could you please elaborate about how the CML solves the problem? And if you are familiar with the term "reasoning engine" and can use it in your answer it would be great as well, as I didn't understand it's meaning.
    – achie
    Dec 21, 2014 at 20:35
  • @achie: I have a low tolerance for worthless buzzwords (like "cognative modelling" and "reasoning engine"). The basic problem is that you've a current state (the state of the game world) and a set of "intelligent entities" that may perform a range of actions; and for each of those entities you need to decide which actions they should perform next based on the current state. This can range from extremely simple to extremely complex; mostly depending on how much "current state" you have and how much effort you put into the logic behind it.
    – Brendan
    Dec 22, 2014 at 16:31
  • Note that "current state" can include past history (e.g. keeping track of where a shark saw a merman last, how often the merman evades left or right, etc), and various statistics (e.g. how hungry a shark is), and an entity's preferences/personalities (e.g. maybe you've got several sharks and some like the taste of mermans more than others).
    – Brendan
    Dec 22, 2014 at 16:43
  • Also; the "decide which actions they should perform" may be tiered. For example, you might have (less frequently executed) code to decide a long-term goal ("shark wants to find the middle of the ocean one day") and this creates more current state that influences the probability of the different actions being selected (e.g. makes the shark more likely to chase a merman west and less likely to chase a merman east).
    – Brendan
    Dec 22, 2014 at 16:56
  • A few questions, hopefully you can answer at least some of them, it would help me a lot: How does CML solve the problem of giving "intelligence" to characters? Is it necessarily related to giving the character a "gap" of what it knows ? Is it necessarily done by balancing between complex pre-programming and expansive run-time decision making? Is it related to pruning necessarily? If so, how is the pruning done? Is there necessarily a pre-processing stage? Thanks for your help. I used the word "necessarily" to understand thoroughly the meaning of CML.
    – achie
    Dec 23, 2014 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.